I have a textbox on the form that displays the last invoice number used named
“LastInvoice” and it has a control source of:
=DMax("[InvoiceNumber]","tblLog")
The "InoviceNumber" is in the format "0000-yy"
Is there a way to code the Default Value of the textbox “InvoiceID” so that
it's the “LastInvoice” textbox value, but increases it’s “0000” value +1.
So now the Default Value of textbox “InvoiceID” is the “LastInvoice” textbox
value “0000” +1 & “-“ & Right([Date],2)
Thanks
You could use a recordset rather than DMax, but there's no need to do that.
The important thing, though, is that you follow Ken's advice and split your
existing field into two separate fields, and concatenate the fields into a
single value for display purposes in a query.
Have two separate pieces of information in a single field, such as you
currently have, is actually a violation of database normalization
principles. You've already seen one of the effects of doing that: it's
difficult to work with the data!
BTW, simply reposting your question again in the same thread is NOT going to
get you a different answer. If you need more information about the answer,
or realized that you didn't give us all the details originally, indicate
what's different the second time: don't just repost the same question!

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
> Is this the only method?
pushrodengine - 17 Dec 2007 18:14 GMT
I have over 1,000 records so far in the table in the format of "0000-yy".
How exactly do I split the field without losing data or re-entering data?
Douglas J. Steele - 17 Dec 2007 20:49 GMT
Add two new fields to the table.
Create an update query that updates those two new fields. Let's assume that
the new fields are named NewID and IDYear, and that the old field was named
OldID. Your SQL would be something like:
UPDATE MyTable
SET NewId = Left([OldID], InStr([OldID], "-") - 1),
IDYear = Mid([OldID], InStr([OldID], "-") + 1)

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
>I have over 1,000 records so far in the table in the format of "0000-yy".
>
> How exactly do I split the field without losing data or re-entering data?
pushrodengine - 19 Dec 2007 21:07 GMT
Where do I enter:
SELECT Field0000 & "-" & Fieldyy AS InvoiceNumber,
FieldName1, FieldName2, FieldName3
FROM TableName;
Thanks
Douglas J. Steele - 20 Dec 2007 01:38 GMT
That's the SQL of a query. You create the query the way you create any other
queries, and then use that query instead of the table.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
> Where do I enter:
>
[quoted text clipped - 3 lines]
>
> Thanks
pushrodengine - 20 Dec 2007 21:25 GMT