Incrementing journal voucher number

D

DBoyd

I creating a form that will need a field that will have a JV field that needs
to increment when a new record is created. The field is 12 characters long
with the last four digits incrementing, JV12TP09_ _ _ _. The JV and TP are
always the same the 12 is the current month and 09 is the calendar year. Can
anyone help me in creating such a number on a form. Thanks!! Using Access
2003.
 
D

Dorian

You will need to get the 4-digit last number assigned from the table using
the DMAX function (look in Access HELP).
While you are in Help, read up on the DatePart function.

Then you create the number with:
JV = "JV" & right$("00" & DatePart("m",date()),2) & "TP" &
right$(DatePart("yyyy",date()),2) & Right$("0000" & CStr(LastNumber +1),4)

I'm assuming all numbers must be left zero-filled.

-Dorian
 

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