Not having much knowledge about codes, I’m trying to make in ACCESS 2003 a form “fr1” with 4 TxtBox s1, s2, s3 and s4 in which I want to be placed automatically random numbers ranging from 1 up to 6.
The code I believe that is suitable for this is the one below:
Function YP4()
Randomize
Dim fr As Form
Dim n As Integer
Set fr = Forms("fr1")
For n = 1 To 4
fr! {"s" + Str
} = Int((6 * Rnd) + 1)
Next n
End Function
The part that is in big brackets, and which is the name of the TxtBox, {“s” + Str
}, is the one that I don’t know how to make.
Could somebody help me with this?
Please take into account that perhaps instead of 4 I may need 10 or even 20 random numbers, therefore I would like to skip the loop n = 1 to…
Thank you in advance!
The code I believe that is suitable for this is the one below:
Function YP4()
Randomize
Dim fr As Form
Dim n As Integer
Set fr = Forms("fr1")
For n = 1 To 4
fr! {"s" + Str
Next n
End Function
The part that is in big brackets, and which is the name of the TxtBox, {“s” + Str
Could somebody help me with this?
Please take into account that perhaps instead of 4 I may need 10 or even 20 random numbers, therefore I would like to skip the loop n = 1 to…
Thank you in advance!