…… N = 0 cnt = Me!电科.Value + Me!电气.Value + Me!自动化.Value + Me!通信.Value + Me!院办.Value + Me!退休.Value Do While Me!抽奖数量.Value > N And Not qrs.EOF And cnt < Me!总数量.Value '电科抽奖 ’四舍五入确定电科中奖数
If Me!电科.Value < (Int(((unit1.姓名之Count / cnt1) * Me!总数量.Value + 0.5))) And N < Me!抽奖数量.Value And cnt < Me!总数量.Value Then If qrs.单位 = "电科" And qrs!批次.Value = 0 Then Me!电科.Value = Me!电科.Value + 1 qrs.Edit qrs!奖励等级.Value = Me!奖励等级.Value qrs!批次.Value = Me!批次.Value qrs.Update N = N + 1 End If Else End If …… '退休抽奖 cnt = Me!电科.Value + Me!电气.Value + Me!自动化.Value + Me!通信.Value + Me!院办.Value + Me!退休.Value cnt2= Me!电科.Value + Me!电气.Value + Me!自动化.Value + Me!通信.Value + Me!院办.Value '剩余数量分配给退休 If Me!退休.Value < Int((Me!总数量.Value – cnt2) And N < Me!抽奖数量.Value And cnt < Me!总数量.Value Then If qrs22.单位 = "退休" And qrs!批次.Value = 0 Then Me!退休.Value = Me!退休.Value + 1 qrs.Edit qrs22!奖励等级.Value = Me!奖励等级.Value qrs22!批次.Value = Me!批次.Value qrs22.Update N = N + 1 End If Else End If …… ’判断是否完成抽奖 cnt = Me!电科.Value + Me!电气.Value + Me!自动化.Value + Me!通信.Value + Me!院办.Value + Me!退休.Value If cnt = Me!总数量.Value Then MsgBox ("抽奖总数已到。") Me.可抽奖.Value = 0 Else MsgBox ("抽奖限制。") End If …… |