Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random generated field but not compulsory

Status
Not open for further replies.

Chance1234

IS-IT--Management
Jul 25, 2001
7,871
US
I have a table called clients and one of the fields is client ref (NOTE NOT A PRIMARY KEY OR KEY FIELD)

In the business process , when a new client is added it takes a while for their ID to come through.

For purposes of my database i don;t want this field to be blank. What i want to do is to add in some sort of random number reference, which can then be overtyped at a later date

any suggestions for the best way of doign this ?

Chance,

Filmmaker, gentleman and up for parole shortly
,
 
If your table has already an AutoNumber field you may consider copy this value in the relevant field.
Otherwise you may take a look at the Randomize and Rnd functions.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
You might also consider using the date and time of the record creation.

myField = "Temp:" & now()

If you have multiple people entering new customers you'll have to eliminate the chance of two being entered at precisely the same second:

myField = CurrentUser & ":" & Now()

A function could run opening the form to make sure that there aren't any delays in getting the Customer ID assigned and keyed in - something like...

DateDiff("d",Date(), CDate(Mid([myField],InStr([myField],":")+1))





John

Use what you have,
Learn what you can,
Create what you need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top