autonumber

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Some of my work orders are numbered when I get them, and I
enter that into my form. Is there a way to also have an
autonumber set up for the same field, so when I get one
that is not numbered, access will autonumber that field if
I don't actually enter one in myself? Please email, I
don't get much chance to check the newsgroups.
 
Use a Number type field instead of AutoNumber.

If the BeforeUpdate event procedure of the form, assign the next available
number:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.NewRecord Then
Me.ID = Nz(DMax("ID", "MyTable"), 0) + 1
End If
End Sub

If several users are adding records at once, this could cause conflicts.

We generally don't email answers.
 
Back
Top