Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / May 2007

Tip: Looking for answers? Try searching our database.

Random Account Numbers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Simon - 17 May 2007 09:42 GMT
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
Graham R Seach - 17 May 2007 12:01 GMT
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

>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
[quoted text clipped - 5 lines]
>
> How would i do this in access
BruceM - 17 May 2007 12:21 GMT
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")

>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
[quoted text clipped - 5 lines]
>
> How would i do this in access
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.