Numbering records in seqence

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to learn how to number records in sequence. I know that auto
number will do this, but that is not its purpose. And it does not always
work. I am not proficient in visual basic, although I can cut and paste and
somewhat understand what some of the code does.
 
bgarey said:
I would like to learn how to number records in sequence. I know that auto
number will do this, but that is not its purpose. And it does not always
work. I am not proficient in visual basic, although I can cut and paste and
somewhat understand what some of the code does.

Example if you insert records using a form and have a numeric field named [ID].
Using the Form's BeforeUpdate event.

If IsNull(Me![ID]) Then
Me![ID] = Nz(DMax("[ID]", "TableName"),0) + 1
End If

This would be reliable for a moderate number of users entering records
simultaneously. Beyond that a separate "Next Value" table can be used. Just
ask here if you think you need that method (which is a bit more involved).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top