A family of Microsoft relational database management systems designed for ease of use.
You might like to take a look at CustomNumber.zip in my public databases folder at:
https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
Note that if you are using an earlier version of Access you might find that the colour of some form objects such as buttons shows incorrectly and you will need to amend the form design accordingly.
If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.
This little demo file includes an option for sequentially numbering rows by group, in my case gender. In your case it would be customer and year. Any conflicts which arise when two or more users are inserting a record simultaneously, and thus get the same number, are trapped and corrected in the form's Error event procedure. This avoids prejudicing the integrity of the data base by prematurely saving an incomplete record. The start number for each sequence defaults to 1, but can be set to any integer number in the form.
In my demo the next number per gender is computed by the following function:
Private Function GetNameID(strGender As String, intStartSequence As Integer)
strCriteria = "Gender = """ & strGender & """"
GetNameID = Nz(DMax("NameID", "NamesByGender", strCriteria), intStartSequence - 1) + 1
End Function
As, in your case, the sequence is determined by the combination of customer and year, you would have to amend your equivalent of this function so that it accepts two arguments, e.g. intInvoiceYear and lngCustomerID. The strCriteria variable would then be assigned a value by building a string expression which uses both values in a Boolean AND operation, e.g.
strCriteria = "Year(InvoiceDate) = " & intInvoiceYear & " AND CustomerID = " & lngCustomerID