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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create date-specific ID...

Status
Not open for further replies.

btj

Technical User
Nov 17, 2001
94
US
I need to create code that creates an ID based on the current date.

This is a maintenance log, so each day there will be a variable amount of jobs. The format I have is:
FEB12_001 (for the first job of today).

Within the ID field, I have created the following code (as a temporary solution):
=[txtMonthID] & [txtDayID] & "_000" where txtMonthID and txtDayID refer to two hidden fields on my form that indicate the current month and day. I could create an Input Mask that would do something similar to what I want, but it would be much more beneficial to create an automatic function.

I can create code that will automatically lookup the Month and Day (already done that, as seen above), but I am unsure how to automatically create a number that must be reset upon each new day.

If anyone could provide me with their thoughts, I would greatly appreciate it.

Thanks,
Ben
 
You could try an empty table with an autonumber field. Add to the field, scoop off the number in a query, then delete the record.
You could automatically compact the database when you wanted to reset the number in the empty table.
Or simply store the last number in a table & read it off & increment each time.
Or look at string manipulation (IsDigit etc.) to retreive the numerical part of the last ID & adds one.
Or have I completely misunderstood? If it don't make you laugh, it ain't true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top