Random Number Generation

N

NChris

Is there a function in Access 2000 that generates a random number? (not an
autonumber)
 
C

chris.nebinger

The function you are looking for is the RND function. Here is an
example of a wrapper around it:


Function RandomNumber(lngMaxNumber As Long, lngStartingNumber As Long)
As Long
'lngMaxNumber is how many numbers to choose from
'lngStartingNumber is the first number available
'I.E, to get a 3 digit number, use RandomNumber(900,99)
Randomize
RandomNumber = Int(Rnd(Timer) * lngMaxNumber) + lngStartingNumber
End Function




Chris Nebinger
 
Top