D
Darren B via AccessMonster.com
I'm trying to make a lottery program for a church org. I've got everything
else finsihed but can not seem to resolve one issue.
During the proformance of the actually lottery I need to check the value
held in the WINNER field at the specified row determined by a random number
generator. So if the RN says 78, I want to access row 78 and check the
value stored in the winner field. I need to check this because if the field
is already a 1 I won't write to that field but rather choose another random
number.
Also, once I know the field is a 0 I want to be able to write a 1 there so
if that number is generated again I won't write to it.
The table is called LotteryEntry, the field is called WINNER. The code I
ahve so far goes like this :
Do While Count < NumberOfSpaces
Randomize
RandomNumber = Int(ListLength * Rnd + 1)
Do While RandomNumber > ListLength
Randomize
RandomNumber = Int(ListLength * Rnd + 1)
Loop
Do While Table!LotteryEntry!Winner(RandomNumber).Value = 1
Randomize
RandomNumber = Int(ListLength * Rnd + 0)
Loop
Table.LotteryEntry.Item(RandomNumber).Winner = 1
Count = Count + 1
Loop
So basically I want to go to the row number that the random number
generates and first see if it is a 1 and if so, I will draw another number,
if not I want to set that field to 1!
I've been looking in books and other forums and nobody seems to know!PLEASE
HELP!!!!!!
Darren
else finsihed but can not seem to resolve one issue.
During the proformance of the actually lottery I need to check the value
held in the WINNER field at the specified row determined by a random number
generator. So if the RN says 78, I want to access row 78 and check the
value stored in the winner field. I need to check this because if the field
is already a 1 I won't write to that field but rather choose another random
number.
Also, once I know the field is a 0 I want to be able to write a 1 there so
if that number is generated again I won't write to it.
The table is called LotteryEntry, the field is called WINNER. The code I
ahve so far goes like this :
Do While Count < NumberOfSpaces
Randomize
RandomNumber = Int(ListLength * Rnd + 1)
Do While RandomNumber > ListLength
Randomize
RandomNumber = Int(ListLength * Rnd + 1)
Loop
Do While Table!LotteryEntry!Winner(RandomNumber).Value = 1
Randomize
RandomNumber = Int(ListLength * Rnd + 0)
Loop
Table.LotteryEntry.Item(RandomNumber).Winner = 1
Count = Count + 1
Loop
So basically I want to go to the row number that the random number
generates and first see if it is a 1 and if so, I will draw another number,
if not I want to set that field to 1!
I've been looking in books and other forums and nobody seems to know!PLEASE
HELP!!!!!!
Darren