Brigham Siton said:
Thanks for the prompt reply.
Ouch, that is a good point. There are 3 people that will be working on
this.
Can I have a control that when the system generates a duplicate invoice that
it prompts for the user to generate a new one?
Brigham
What you could do is use "for display" an invoice number that is as you
described, but which has an incremental number tacked onto the end. Then you
could "store" the creation date and time in a DateTime field along with an
integer field that is incremented throughout each day and starts over the next
day. All that would be necessary then would be to calculate the max value of
the integer field with a date of Today and add one to it.
In form's BeforeUpdate event
If IsNull(Me!NumberFieldName) = True Then
Me!NumberFieldName = Nz(DMax("NumberFieldName","YourTableName",
"DateValue(DateField) = Date()"),0)+1
End If
On your forms and reports display the invoice number with the following
expression:
=Format(DateField,"yymmddhhnn") & Format(NumberFieldName, "00")
The above would be good for 99 invoices per day. If you thought you might
exceed that, you could use "000" for the second part.