Custom auto number

G

Guest

I want to have an auto number that goes off of the date and also adds a
number eather before it of after it...EX. 05-0001..05 being the year and 0001
being the number for that year. I will need this to change from year to
year.Thanks Dueyx
 
R

Rick Brandt

Dueyx said:
I want to have an auto number that goes off of the date and also adds
a number eather before it of after it...EX. 05-0001..05 being the
year and 0001 being the number for that year. I will need this to
change from year to year.Thanks Dueyx

*Store* as two separate fields RecordDate and RecordID. In the BeforeUpdate
event of the form used to insert rcords have code...

If IsNull(Me.RecordID) = True Then
Me.RecordID = Nz(DMax("RecordID", "TableName", "Year(RecordDate) =
Year(Date)"), 0) + 1
End If

*Display* using the expression...

Format(RecordDate,"yy-") & Format(RecordID, "0000")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top