Guest_imported
New member
- Jan 1, 1970
- 0
Hi all!
I hope someone can help me.
I've got a script that returns a random recordset. I loop throught the database a specified number of times and need to have a unique return each time.
I just can't seem to get my head around the concept of arrays and I think that is what I need to do to get this done!
Here is some code:
' begin random function
randomize
'Set your Min and Max Values
CollisionRandom_Number_Min = 001001
CollisionRandom_Number_Max = 001025
' random numbers is the varible that will contain a numeric value
Random_Number = Int(((CollisionRandom_Number_Max-CollisionRandom_Number_Min+1) * Rnd) + CollisionRandom_Number_Min)
CollisionCommand = "SELECT * FROM question LEFT OUTER JOIN answer " & _
"ON question.index=answer.index WHERE CInt(Question.Index) = '"&random_number&"'"
' ORDER BY Question.Index,Response"
So....I guess my question is:
How to I specify in my CollisionCommand statement to get the random Question.Index, but only if it hasn't already been used??
Does this make sense??
Thanks to all who help!
I hope someone can help me.
I've got a script that returns a random recordset. I loop throught the database a specified number of times and need to have a unique return each time.
I just can't seem to get my head around the concept of arrays and I think that is what I need to do to get this done!
Here is some code:
' begin random function
randomize
'Set your Min and Max Values
CollisionRandom_Number_Min = 001001
CollisionRandom_Number_Max = 001025
' random numbers is the varible that will contain a numeric value
Random_Number = Int(((CollisionRandom_Number_Max-CollisionRandom_Number_Min+1) * Rnd) + CollisionRandom_Number_Min)
CollisionCommand = "SELECT * FROM question LEFT OUTER JOIN answer " & _
"ON question.index=answer.index WHERE CInt(Question.Index) = '"&random_number&"'"
' ORDER BY Question.Index,Response"
So....I guess my question is:
How to I specify in my CollisionCommand statement to get the random Question.Index, but only if it hasn't already been used??
Does this make sense??
Thanks to all who help!