Someone, John Vinson I think, once said "Autonumbers are not fit for human consumption!" and truer words have never been spoken! There are simply too many things that can cause gaps in Autonumbers, other than deleted records! And things such as corruption can cause procedures to be used that will change the autonumbers.
For ID numbers, especially where they will be referred to/referenced in hard copy documents (yes, people, some people do actually have non-PC generated documents) you really should use code to generate auto-incrementing numbers. It's not that difficult:
- Private Sub Form_BeforeUpdate(Cancel As Integer)
-
If Me.NewRecord Then
-
If RecordsetClone.RecordCount = 0 Then
-
Me.IDField = "CP0001"
-
Else
-
Me.IDField = "CP" & Format(DMax("val(Right([MyID],5))", "YourTable") + 1, "00000")
-
End If
-
End If
-
End Sub
Where:
IDField is the textbox on your form holding the "number."
MyID is the field on your table holding the "number."
MyID is of
Datatype Text.
YourTable is the name of your underlying table.
Welcome to TheScripts!
Linq
;0)>