Terry,
While David's information about setting a value to an AutoNumber field is correct, his solution still indicates an intention of continuing to use the AutoNumber field as the invoice number. I must continue to maintain my position about using this type of field for this. I believe that it will eventually lead to problems.
I am sure that others here may have other ways of managing an invoice numbering scheme, but here is one way that it can be done:
I have found that in many of my applications, I will have various things like default values and default paths, etc. that I what to allow users to define while they are using the application. I will typically store these values in a table that I name "AppValues". This table can then have any number of fields but will never have more than one row or set of values. It is in this table that I would create a field in which to store my seed value to be used in creating the next invoice number. I might call this field "InvSeedVal" and make it either a string type field (if I intended to have any alpha characters in my invoice numbering scheme) or a numeric, long integer, type field if the invoice numbers were only going to have number type characters.
For my example I am going to use the numeric, long integer, type field.
To use the code below will require that you add a reference to the Microsoft DAO 3.6 Object Library (or the version number of the DAO Object Library that is currently available on your computer). To set this reference, open the Visual Basic code window and then select "References" from the "Tools" option on the menu. Then locate the "Microsoft DAO 3.6 Object Library" option and place a check in the check box at the left end of that option and click Ok button to close the Reference window.
The VBA code to manage the invoice number would go something like this:
'define a variable to hold the current invoice seed value
dim lngInvSeedVal as Integer
'define a vairiable to hold the next invoice value
dim lngNxtInvVal as Integer
'define a record set variable
dim rs as DAO Recordset
'open a recordset against the "AppValues" table
set rs = currentdb.OpenRecordset("AppValues")
'read the value from the "InvSeedVal" field in the "AppValues" table
'and store the exising value in a variable
lngInvSeedVal = rs.Fields("InvSeedVal").value
'increment the existing value by one to create the next Invoice number
lngNxtInvVal = lngInvSeedVal + 1
'update the "InvSeedVal" field in the "AppValues" table with the most recent invoice number
'open the record set for editing
rs.edit
'assign the new value to the field
rs.field("InvSeedVal").value = lngNxtInvVal
'save the new value in the table
rs.update
'close the recordset
rs.close
set rs = nothing
Now you can use the value in the "lngNxtInvVal" variable anywhere you desire, including assigning it to a text box as the new Invoice number.
Hope this helps.