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!

Autonumber with date

Status
Not open for further replies.

McFestoe

Technical User
Dec 16, 2003
145
GB
Is there a way to have autonumber in a format of yy/mm/dd/0001 so it would be easy to look up a record by the date.

 
How about having another field for Date? If you want it to be the date that the record is added, set it's DEFAULT to

=Date()

which is just the date, or

=Now()

for the Date and Time.



Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
GingerR

Thats what i have now, just thought i might be able to add it to the auto number.

Thanks for the reply.
 
Do not recommend it, but you could theoretically build a table with date field as the Primary Key instead of an autonumber. Set the default value to "now()".
So if you never added records faster than 1 a second you are OK. But this fails as soon as you try an update query, or programmatic recordset manipulation, because records would be added (fail to be added) faster than one a second. But in certain cases it could work.
 
You could make a query that you use for sorting, and put in a calculated field that concatonates the date and the ID field. Use the STRING() function to pack it with zeros.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top