Auto increment of invoice number (1 Viewer)

nashfaq

Registered User.
Local time
Today, 21:06
Joined
Oct 17, 2018
Messages
28
Hello team

i am in access so have less knowledge

i have primary key that is the code of the customer

i also have a Invoice no with a pattern of XXXXX/XX that is Text and controlled by the MASK

i want that when i enter a INVOICE Number, when i go to next or save the form and new form opens, that invoice number changed automatically

like 12345/01 when i go to next it will automatically changed to 12345/02 and so on , until i change the invoice number

it also allows me to change the invoice number when i need it to change.

please help me on this

Regards
Nasir
 

Minty

AWF VIP
Local time
Today, 18:06
Joined
Jul 26, 2013
Messages
10,371

plog

Banishment Pending
Local time
Today, 12:06
Joined
May 11, 2011
Messages
11,646
First:

XXXXX/XX that is Text

When you want to do mathematical operations on data (like add 1) you need to store your data in types that handle that:
"23" + "1" = "231"
23 + 1 = 24

store numbers as numbers

Second, discrete pieces of data needs to be stored discretely. You've got a main invoice number XXXXX and then a sub-invoice number XX. Those should be 2 different fields in your table.

Third, all the above is moot, I agree with Minty. Use an autonumber and call it a day. Numbers aren't mystical entities. Often, as in this case, they simply help reference something. There's no gain from having some special algorithm to produce your invoice numbers.
 

Users who are viewing this thread

Top Bottom