random number generator

  • Thread starter Thread starter aspgk
  • Start date Start date
A

aspgk

Hello:

i want to set a value.. call it delay time... using an access function that
would statistically select a number with a range... say 1-100. Is this
possible in Access? I sure can't find it if there is one...

Please advise & thanks

Paul
 
Access will generate random number with the RND command. You could do
rnd([>100]), rnd([<1]), rnd([>.000001]), etc to get whatever range you need.
If you leave it blank, you will just get some random number.
 
aspgk said:
i want to set a value.. call it delay time... using an access function that
would statistically select a number with a range... say 1-100. Is this
possible in Access? I sure can't find it if there is one...


Look in VBA Help for the Rnd function and the Randomize
statement.
 
thanks for taking the time to respond to this

Golfinray said:
Access will generate random number with the RND command. You could do
rnd([>100]), rnd([<1]), rnd([>.000001]), etc to get whatever range you need.
If you leave it blank, you will just get some random number.

aspgk said:
Hello:

i want to set a value.. call it delay time... using an access function that
would statistically select a number with a range... say 1-100. Is this
possible in Access? I sure can't find it if there is one...

Please advise & thanks

Paul
 
thank you .....

raskew via AccessMonster.com said:
Hi -

Copy/paste this to a standard module

Public Function GenRndNumber(Upper As Double, Lower As Double) As Double
Randomize
GenRndNumber = Int((Upper - Lower + 1) * Rnd + Lower)
End Function

...then call it (from the debug (immediate) window like this:

? GenRndNumber(100, 1)

HTH - Bob
 
Access will generate random number with the RND command. You could do
rnd([>100]), rnd([<1]), rnd([>.000001]), etc to get whatever range you need.
If you leave it blank, you will just get some random number.

Golfinray, won't the square brackets have Access looking for a Field
or a Parameter named [>100] or the like? Take a look at the online
help for Rnd - it doesn't work the way you're describing!
 
Back
Top