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

concatenating field with specific date format included

Status
Not open for further replies.

Ravensleach

Programmer
Oct 19, 2004
45
PE
Seasons greetings!

I want to create a single field in a form (that can copy and paste into Word) with the following format:

FCD-DID-07-001

Purpose is to generate unique references for letters. The 07 is the year in yy format and the 001 needs to increment by one for each new record.

This is the latest expression: ="FCD-DID-" & [yy] & "00" & [id], producing

FCD-DID-12/26/2006 9:42:14 AM-001

[yy] is from a date field in the underlying table but I can't get it to format as yy despite setting this format in the table and query. [id] is an autonumber field, I would prefer it to update to 010 and 101 as it gets to that point rather than have to re-do the expression.

Can you help? Sorry if this has been covered before but the forum search doesn't seem to be working.
 
You can use:

Format([yy],"yy")

and

Format([ID],"000")

That is:
="FCD-DID-" & Format([yy],"yy") & Format([ID],"000")
 
Thank you Remou you are a star, works exactly how I want it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top