If I needed a string like this as an ID field, I would create it on the Before Insert event of the data entry form. This will create the string as the record is inserted, which means it is generally not available for viewing until after the record is created.
I would use an AutoNumber field, that is hidden, since this will allow Access to manage the final digits in the string, and prevent conflicts that could be difficult coding. The issue here is that Access will only create the AutoNumber after the first field has been filled in, so the Before Insert is your best bet.
If your AAAA is always the same, then on the Before Insert event of the form you might put:
Dim sString As String
sString = "AAAA-"
sString = sString & Right(DatePart("yyyy", Date()), 2)
sString = sString & "-" & Me.AutoNumberField
This will derive your number. The last issue is the number of 0 before the integer that is in the AutoNumber field ("10" instead of "00000010"). I have to go to a meeting so can't solve that now. Anyone else?
Did that help?
mmcdonal
Look it up at:
http://wrox.books24x7.com