Im trying to randomize some figures into a child form, which in this code works, then I want to order the records by the random numbers, (this is the bit I'm stuck on!), then once ordered, I want to sequentially number the entries (this bit also works in the code).....
Private Sub Command17_Click()
Dim N As Integer, I As Integer, J As Integer
Dim W As Integer, X As Integer, Y As Integer, Z As Integer
N = DCount("[ID Number]", "Tournament")
Do While I < N
For J = 1 To Forms![Tournaments]![Numbers]
I = I + 1
If I <= N Then
DoCmd.GoToRecord , , acGoTo, I
[Heat 1 Group] = Int(Rnd([Tournament]) * 1000)
End If
Next
Loop
Rem Order By [Heat 1 Group]??????????
W = DCount("[ID Number]", "Tournament")
Y = 1
Do While X < W
For Z = 1 To Forms![Tournaments]![Numbers]
X = X + 1
If X <= W Then
DoCmd.GoToRecord , , acGoTo, X
[Heat 1 Group] = Y
End If
Next
Y = Y + 1
Loop
End Sub
Many thanks in advance to any replies
Private Sub Command17_Click()
Dim N As Integer, I As Integer, J As Integer
Dim W As Integer, X As Integer, Y As Integer, Z As Integer
N = DCount("[ID Number]", "Tournament")
Do While I < N
For J = 1 To Forms![Tournaments]![Numbers]
I = I + 1
If I <= N Then
DoCmd.GoToRecord , , acGoTo, I
[Heat 1 Group] = Int(Rnd([Tournament]) * 1000)
End If
Next
Loop
Rem Order By [Heat 1 Group]??????????
W = DCount("[ID Number]", "Tournament")
Y = 1
Do While X < W
For Z = 1 To Forms![Tournaments]![Numbers]
X = X + 1
If X <= W Then
DoCmd.GoToRecord , , acGoTo, X
[Heat 1 Group] = Y
End If
Next
Y = Y + 1
Loop
End Sub
Many thanks in advance to any replies