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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Random Password Generation 0
Random Spinner 0
How random is Rnd 12
Word does random actions (Mac) 0
Truly Random Numbers 10
random number generation 2
Generate a random 6 character output 3
Random Generator in Excel? 4

Top