View Full Version : Potential Problem with Using Random Number


crhodus
04-23-2001, 12:49 PM
On one of my forms, I have field called CallID. CallID is also the primary key for my table.

I have the default value for CallID set to :
=[Forms]![Contacts]![Name] & " - " & Rnd()

Each time the user enters a new call, the CallID value becomes the Company Name plus a random number. (Ex: ACME Trucks - 0.7642685)

Several different users will be using this program to enter data. At the end of each week each user will send his/her data to the home office so that it can be imported into a master file.

Can anyone see any problems that I might encounter by concatinating the company name and a random number?

I'm not sure if this is the best way to go about creating a primary key.

Thanks!

DES
04-23-2001, 04:34 PM
Yes I could see potential problems but they are small. It is possible that the same random number may be generated for the same company name by somebody else although it is very slight.

If you are unsure you could always do an update query into a table that you set up specifically to group the information into one table and specify that the index can contain no duplicates. The down side of this is that it will only create an error message and not import the data if it is not unique and then you would have to manually enter the data in with a new number.

However if you updated them into a table with the same fields but them add one field for as an autonumber then all the data would be imported and you could then do a query for finding duplicates.

Sorry just rambling...

Glad to discuss it through email if you would like.

DES