Look at my point of view:
Public Function SetPO() As String
Dim db As Database
Dim rs As Recordset
Dim NewNr As Long
Set db = CurrentDb
Set rs = db.OpenRecordset("Table1", dbOpenTable)
rs.Index = "NumberID"
If rs.RecordCount <= 0 Then
SetPO = "PO100001"
Else
rs.MoveLast
NewNr = CLng(Mid(rs!NumberID, 3)) + 1
If NewNr <= 999999 Then
SetPO = "PO" & LTrim$(Str$(NewNr))
Else
MsgBox "NumberID too big"
SetPO = "********"
End If
End If
rs.Close
db.Close
Set db = Nothing
Set rs = Nothing
End Function
In NumberID control on a Form, set DefaultValue to SetP()
or
Private Sub Form_BeforeInsert(Cancel As Integer)
Me!NumberID = SetPO()
End Sub