Customizing Autonumber

escaflowne_moon

New member
Local time
Today, 17:50
Joined
Mar 10, 2007
Messages
1
I don't know where this applies to which category since it overlaps in a way.

How can I customize with VB codes for an autonumber which is the primary key called "FileNumber" This number consist of AUD-001 in this format..but there are different divisions so there could be PAY-001 depending on the division..how can I write a code that will generate this automatically like a autonumber in sequences. I don't know if this can be done.
 
if the prefix is irrelevant to the number, i.e. if you have AUD-001 you cannot have PAY-001, you can create the primary key simply by concatenating the pieces you require along with a record count:
Code:
recNumber = DCount("*",table,"1") + 1
pKey = strPrefix & "-" & Format("000", recNumber)

if you can have both AUD-001 AND PAY-001:
Code:
recNumber = DCount("*", table, "pKey LIKE (" & strPrefix & "*)") +1
pKey = strPrefix & "-" & Format("000", recNumber)
 

Users who are viewing this thread

Back
Top Bottom