Woodrat,
My recommendations:
1. Add an AutoNumber data type field to this table, to serve as the Primary
Key, and to relate the records in this table with other data.
2. I am not sure whether you already have a date field in the table. But
if not, add one, let's call it DateCreated, and set its Default Value
property to:
Date()
3. Do not store your combined identifying number in the table. Just have
another field, Number (Integer) data type, let's call it YearSerial. On the
form that you use for data entry, set the Default Value of a textbox
(probably hidden, i.e. Visible = No) bound to this field, to the equivalent
of this:
Nz(DMax("[YearSerial]","NameOfYourTable","Year([DateCreated])=Year(Date())"),0)+1
4. Whenever you need this combined ID for your purposes on form or report,
set it as a calculated field in the query that the form or report is based
on, using syntax like this:
CombnedID: Format([DateCreated],"yyyy") & "-" & Format([YearSerial],"0000")
Or, similarly, enter directly to the Control Source of an umbound textbox on
your form or report:
=Format([DateCreated],"yyyy") & "-" & Format([YearSerial],"0000")
--
Steve Schapel, Microsoft Access MVP
woodrat said:
Yes, start with the current year, and then on Jan, 1 of the next year use
that year.
So it will always start with the current year.
Yes, restart the numbering on Jan 1 of each year.
4 didgt to be safe.
Like 2009-0152, 2009-0153 ........, on Jan 1 start over 2010-0001,
2010-0002.
Thanks
.