Random Number in Table Field

G

Guest

I have table and I want one of the fields to generate a random number every
time a new records is created. I want the random number to be less than 2
digits and can be duplicate values.

I select Autonumber for data type and Random for New Values. Is there
something I can put in Format to make sure the "random number" is than 2
digits. So to the number could 1 to 99.

Thanks for any help.
 
G

Guest

Autonumber will not do what you are looking for. Check out the Rnd function
Int(99 * Rnd +1)
I would set the field value on the forms before update event to to this.
You may be able to do this in the default value in the table, but I am not
sure. Make sure your tables data type is an integer.
 

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