autonumber problem

X

xodusss

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.
 
J

John Vinson

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?

You cannot do this with an Autonumber field. Instead, you'll need to
use VBA code to assign values to a Long Integer field. If it's a
one-user system, this can be pretty simple: in the Form's AfterInsert
event, put code like

Private Sub Form_AfterInsert
Me!txtWorkOrder = NZ(DMax("[WorkOrder]", "[WorkOrders]")) + 1
End Sub

(using your own table and fieldnames of course).
Please email, I don't get much chance to check the newsgroups.

Hm. That's odd. You're expecting us volunteers to donate our time to
answer your question, but don't find the answer important enough to
bother to come back for it. Ok... as you wish.
 

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