Random Number

G

Guest

I have a table with a field name of "NumberID". When a new record is
generated I want a random number to go into "NumberID". I just want the
number always to be less than 2 digits. So it could 1,01,2,02,etc all way up
to 99 but I do not want it to more than 2 digits. It does not matter if
there is duplicate values in the field.

Is there way to do this? Thanks for any help.
 
G

Guest

Excerpt from the MS Visual basic helpfile on the Rnd() funtion. (Randomize):

To produce random integers in a given range, use this formula:

Int((upperbound - lowerbound + 1) * Rnd + lowerbound)

Here, upperbound is the highest number in the range, and lowerbound is the
lowest number in the range.

jmonty
 

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

Top