jiblankman
Registered User.
- Local time
- Today, 00:07
- Joined
- May 27, 2008
- Messages
- 43
I have a table with a list of people. I am creating a new table including a specific number of people selected "at random" from the first table. Here is the code that I am using:
If I open the database and run this routine I get list 1 which always has the same people in it. If I run the program again, I get list 2 which always has the same people in it but are different from list 1.
I have tried placing the Randomize command at different locations within the code. I have also tried "Randomize Timer" instead of "Randomize" and there is no difference.
Any ideas would be greatly appreciated as this is causing some real issues for us. Thanks.
Code:
Dim strSQL As String
Randomize
strSQL = "SELECT TOP " & NumberToPick & " * INTO [Random Selections] FROM [Random Pool] ORDER BY Rnd(count);"
CurrentDB.Execute strSQL
If I open the database and run this routine I get list 1 which always has the same people in it. If I run the program again, I get list 2 which always has the same people in it but are different from list 1.
I have tried placing the Randomize command at different locations within the code. I have also tried "Randomize Timer" instead of "Randomize" and there is no difference.
Any ideas would be greatly appreciated as this is causing some real issues for us. Thanks.