User Defined Autonumber

DavidRS

Registered User.
Local time
Today, 22:11
Joined
Jan 4, 2005
Messages
43
Can anyone help?

Is it possible to have an autonumber that is generated depending on the entry in a particular field? I'm creating a database to track various enquiries and I would like each enquiry to have a unique number that is preceded by a codenumber that identifies its origin. For example:

ABC query - 100xxx
DEF query - 200xxx
XYZ query - 300xxx

(xxx denotes the autonumber part)

This way a particular query can be identified just from its number without having to interrogate the main record.

Can it be done? I've searched other posts and not found quite what I'm looking for.

(If not then no probs - I'll think of another way!)

Thanks in advance
 
You can use a 2 field part number. The first field is the class of the part and the second field is the actual part number. Using this structure, the part number can be an autonumber if you want it to be. Or, you can generate your own sequence number. There are numerous posts here that tell you how to generate your own. Basicly you use DMax() to find the last issued number and add 1 to that:

PartNum = Nz(DMax("PartNum", "tblParts", "PartClass = '" & Me.PartClass & "'"),0) + 1

You also need to be aware that generating your own "autonumber" in a multi-user environment can lead to the generation of duplicate numbers so your code needs to be able to handle this situation and get the next available number when the original one was a duplicate.
 
Pat,

Thanks for the reply - having considered what you said, I think I'll do something a bit more simple.

Cheers

David
 

Users who are viewing this thread

Back
Top Bottom