1,216
社区成员
发帖
与我相关
我的任务
分享
mCount = Rs.RecordCount
Randomize Timer
Number = Number
For k = 1 To Number
Rs.Requery
Rs.Filter = "flag<>1"
mCount = Rs.RecordCount
If mCount = 0 Then Exit For
lCurRow = Int(Rnd * mCount) + 1 '产生一个随机数
Rs.Move lCurRow - 1 '定位
a = Rs!bh
List1.AddItem Rs!bh
List1.AddItem Rs!xm
Label4.Caption = Rs!xm
n = n + 1
Label5.Caption = n
Cn.Execute ("update shiyan set flag=1 where bh=" & a & "") '字符型的需加单引号 bh='" & a & "' "
Next
mCount = rs.RecordCount
Randomize Timer
Number = Val(Text1.Text)
For k = 1 To Number
lCurRow = Int(Rnd * mCount) + 1 '产生一个随机数
rs.Move lCurRow - 1 '定位
Do While Not rs!flag = 1
MsgBox "已存在!", vbExclamation, "提示"
lCurRow = Int(Rnd * mCount) + 1
rs.movefirst
rs.Move lCurRow - 1 '定位
Loop
a = rs!bh
db.Execute ("update shiyan set flag=1 where bh=" & a & "")
List1.AddItem rs!bh
List1.AddItem rs!xm
Label4.Caption = rs!xm
n = n + 1
Label5.Caption = n
Next k
rs.Close