AutoNumber

C

Charlie

I need an autonumber field to be incrimented by more than
1. I would like it incrimented by 5 on each new record. I
use the autonumber to give me import order in a invoice
database. If i want to add a row to the invoice i can't
do so beacause the autonumbers are 1,2,3,4,5 for eg and I
cant' use 1.1, 1.2,1.3. etc.
How do I do this?
 
T

Tim Ferguson

I need an autonumber field to be incrimented by more than
1. I would like it incrimented by 5 on each new record. I
use the autonumber to give me import order in a invoice
database. If i want to add a row to the invoice i can't
do so beacause the autonumbers are 1,2,3,4,5 for eg and I
cant' use 1.1, 1.2,1.3. etc.

"If you care what value an Autonumber has, then you probably should not be
using an Autonumber"

If you want to control the allocation of unique numbers you need to do it
yourself in code. Try googling for "Access Custom Autonumbers"

B Wishes


Tim F
 
J

John Vinson

I need an autonumber field to be incrimented by more than
1. I would like it incrimented by 5 on each new record. I
use the autonumber to give me import order in a invoice
database. If i want to add a row to the invoice i can't
do so beacause the autonumbers are 1,2,3,4,5 for eg and I
cant' use 1.1, 1.2,1.3. etc.
How do I do this?

Don't use an Autonumber field AT ALL for this purpose (it cannot be
edited, for one thing, so you wouldn't be able to insert records in
between existing records anyway).

I'd suggest using a Form for all your data entry (table datasheets
don't provide any usable events). I presume you have an invoice main
table related one-to-many to a Details table? If so, on the Details
subform's BeforeUpdate event, invoke the Code Builder by clicking the
.... icon and put code like

Private Sub Form_BeforeInsert()
Me!txtLineNo = NZ(DMax("[LineNo]", "[Details]", _
"[InvoiceID] = " & Me!txtInvoiceID)) + 5
End Sub
 
R

Roger Carlson

On my website (see sig below) is a small sample database called
"AutonumberProblem.mdb" which illustrates a solution much like John's.
 

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