You will have to extract the number part, increment the value then combine with text. Then you should deal with situation of blank db, before records input. Here is sample code:
Code:
Function GetInNr
strInNr = Nz(DMax("InNr", "Table1"), "")
If strInNr = "" Then
'this accommodates very first generated number of blank database
strInNr = "AW1"
Else
strInNr = "AW" & Mid(strInNr, 2) + 1
End If
GetInNr = strInNr
End Function
You should be aware that alpha sort rules apply. AW129 will sort before AW2. If you want correct sequence, need placeholder zeros, like: AW002, AW010, AW129.
How high do you expect this series to get? I have code that builds a sequential identifier but it starts over each year. The series has never exceeded 4500.
Code:
strLabNum = Nz(DMax("LabNum", "Submit"), "")
If strLabNum = "" Then
'this accommodates very first generated number of blank database
strLabNum = Year(Date) & "A-0001"
Else
'this accommodates change in year
If Left(strLabNum, 4) = CStr(Year(Date)) Then
strLabNum = Left(strLabNum, 6) & Format(Right(strLabNum, 4) + 1, "0000")
Else
strLabNum = Year(Date) & "A-0001"
End If
End If