Private Sub Command0_Click()
Dim aa As Integer '取值范围
Dim bb As Integer '取值个数
Dim n As Integer
Dim m As Integer
Dim str As String
Dim rst As New ADODB.Recordset
aa = 49
bb = 8
n = 0
m = 0
Randomize
rst.Open "表1", CurrentProject.Connection, , adLockOptimistic
DoCmd.SetWarnings False
DoCmd.RunSQL "delete * from 表1"
DoCmd.SetWarnings True
Do Until n = aa
n = n + 1
rst.AddNew
rst(0) = n
rst.Update
Loop
Do Until m = bb
m = m + 1
rst.MoveFirst
n = Int((aa * Rnd) + 1)
rst.Move n
str = str & " " & rst(0)
rst.Delete
aa = aa - 1
Loop
MsgBox str
End Sub
[此贴子已经被作者于2006-5-27 10:02:13编辑过]
|