B
barbun
Hi from italy ,
so sorry for my bad english...................
I have a table "Pronostico" with only one field "NR" and in this field
example there are this values :
2
4
6
8
10
12 ecc
I search to write a vba code to generate a random number THAT THERE ARE in
value above, example i want return
6
8
10
4
6
ecc. ecc
I have write this code, but is wrong because return value to 1 to first
value in "NR"
Public Sub test()
Dim Num1 As Byte
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE * FROM Colonne;"
DoCmd.SetWarnings True
Set rst = CurrentDb.OpenRecordset("Colonne")
Set vin = CurrentDb.OpenRecordset("Pronostico")
For x = 1 To 10
Num1 = Int(Rnd(1) * vin!Nr) + 1
rst.AddNew
rst!Num1 = Num1
rst.Update
Next x
End Sub
How change ????
Many thanks !!
so sorry for my bad english...................
I have a table "Pronostico" with only one field "NR" and in this field
example there are this values :
2
4
6
8
10
12 ecc
I search to write a vba code to generate a random number THAT THERE ARE in
value above, example i want return
6
8
10
4
6
ecc. ecc
I have write this code, but is wrong because return value to 1 to first
value in "NR"
Public Sub test()
Dim Num1 As Byte
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE * FROM Colonne;"
DoCmd.SetWarnings True
Set rst = CurrentDb.OpenRecordset("Colonne")
Set vin = CurrentDb.OpenRecordset("Pronostico")
For x = 1 To 10
Num1 = Int(Rnd(1) * vin!Nr) + 1
rst.AddNew
rst!Num1 = Num1
rst.Update
Next x
End Sub
How change ????
Many thanks !!