The easiest way may be to use something like this in the form's Current
event. The code assumes that the number is stored in a Number field named
SequenceID in the table tblSeq. Substitute your actual field and table
names.
Private Sub Form_Current()
Dim lngSequence As Long
' For the first record only, Nz is needed
lngSequence = Nz(DMax("[SequenceID]", "tblSeq"), 65000)
If Me.NewRecord Then
If Right(lngSequence, 3) = 999 Then
Me.SequenceID = lngSequence + 2
Else
Me.SequenceID = lngSequence + 1
End If
End If
End Sub
The first number will be 65001, the next 65002, etc.
Make a query based on the table. Add a calculated field (give it whatever
name you like):
SeqFormat: Right([SequenceID],3) & Chr(Left([SequenceID],2))
Switch to the query datasheet view to see how it looks. Here's how it
works:
Right([SequenceID],3) takes the rightmost three characters from SequenceID
(001 in the case of the first number). Chr(Left([SequenceID],2)) applies
the Chr function to the leftmost 2 digits from SequenceID (65 for the first
999 records). The Chr function returns the character that is associated
with the number 65 in the ASCII character set, which is "A".
Back to the VBA code, if the rightmost three digits in the highest
SequenceID are 999, the code adds two instead of 1, so that 66000 is
skipped. The next number is 66001. Chr(66) is B, and the formatted
sequence begins again at 001B.
Base a form on the query, and bind a text box to the SeqFormat field in
order to see the number displayed in the format you prefer.
Remember that the format of the stored number is not important. There is
probably a way to store the number as 001A, 002A, etc., but it would be
considerably more complex to work out the code, with no difference to the
end user.