Random Account Numbers

S

Simon

I would like account number to be a 4 digit Number and every time one
is created i would like it a random number as long as that number has
not already been used

I just do not like the idea of giving Cusomer 0001, 0002, as it does
not look like we have been in business long, would like random number
like 5849, 2179, 0485, ect


How would i do this in access
 
G

Graham R Seach

Simon,

Make the Customer table's primary key an AutoNumber datatype, and set it's
NewValues property to Random.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
B

BruceM

Why not just start at 5000 or something? If customers are going to make
assumptions based on their account number, they will do so for a number such
as 0021 whether it is generated randomly or sequentially.
Having said that, take a look at the Rnd function. If you do a Google
groups search for "microsoft public access random number" you will find a
lot of discussion about this very topic. In general you could use something
such as:
Me.AccountNum = Format(Rnd() * 10000,"0000")
 

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