Consecutive Numbering

G

Guest

In my database I have a field that should be numbered consecutively. I know
that Autonumber datatype can be used however, that begins with number 1, 2,
etc. consecutively but I want the numbers to begin with e.g. 5551, 5552
series etc.

Does anyone know if that can be done using something similar to the Fill
series numbering feature in Excel? If not, does anyone have a macro that may
do this?

Thanks
 
J

John W. Vinson

In my database I have a field that should be numbered consecutively. I know
that Autonumber datatype can be used however, that begins with number 1, 2,
etc. consecutively but I want the numbers to begin with e.g. 5551, 5552
series etc.

Does anyone know if that can be done using something similar to the Fill
series numbering feature in Excel? If not, does anyone have a macro that may
do this?

Thanks

Are you trying to insert numbers into a NULL field in existing records, or
into new records as they are entered?

If the latter, use a Form to do your data entry (tables have no usable
events); in the form's BeforeInsert event edit code to something like:

Private Sub Form_BeforeInsert(Cancel as Integer)
Me!txtMySeqNumber = NZ(DMax("[MySeqNumber]", "[MyTable]")) + 1
End Sub

using your own field and table names of course.

John W. Vinson [MVP]
 

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

Top