You can't! Autonumbers are intended to be used for one purpose and only one purpose, to provide a unique identifier for each record. Here's a psot I've archived from a gentleman named John Vinson, MVP, explaining how autonumbers work:
When using Autonumber, do be aware that there will be gaps in the numbering - any record that's deleted will leave a gap; hitting <Esc> after starting a record will leave a gap; adding records using an Append query may leave a gap, often a huge one; replicating the database will make your invoice numbers random.
In short... it's best NOT to use Autonumbers for human consumption, and particularly not for consumption by accountants and auditors. Invoice sequences like 319, 321, 322, 385, 386, 221841246, -1083225152 make such people get very nervous.
For the kind of field you're using, OrdNum, you need to use an
auto-incrementing number hack such as one of these.
The first code here would be for an IDNumber that is defined in the table as Text datatype. "Number" fields that aren't used for math really should be defined as Text.
- Private Sub Form_BeforeUpdate(Cancel As Integer)
-
If Me.NewRecord Then
-
If RecordsetClone.RecordCount = 0 Then
-
Me.IDNumber = "1"
-
Else
-
Me.IDNumber = DMax("val([IDNumber])", "YourTableName") + 1
-
End If
-
End If
-
End Sub
-
If you insist on using a Numerical field:
- Private Sub Form_BeforeUpdate(Cancel As Integer)
-
If Me.NewRecord Then
-
If RecordsetClone.RecordCount = 0 Then
-
Me.IDNumber = 1
-
Else
-
Me.IDNumber = DMax("[IDNum]", "YourTableName") + 1
-
End If
-
End If
-
End Sub
Welcome to
Bytes!
Linq
;0)>