Auto sequence

  • Thread starter Thread starter Francisco
  • Start date Start date
F

Francisco

Hi:

I;m lloking for a way to make my numbers in the PO oder
Form to change when a new Purchase order is entered.
Ex:
[PO Number]= 12345

I want for the next page to automatically go to:

[PO Number]= 12346, and so on

I was already sent something but it was for Access 97, and
I currently use the 2000 version.
Is there a way to do this, in a code or something, and
where to insert this code.

Thanks in advance!
 
Here is something I use. I put a text box called MaxPO in the footer of the
form set to "=Max([PO Number])". This will tell you the highest PO Number.
If you use something other than a number for your PO you will have to do
some parsing for this to work. I set the form's allow addition to false and
have a command button to create the new PO. To the onclick event of the
button I add code to change the allowaddition to true, goto the new record,
set the PO number of the new entry to MaxPO + 1, then set the allow
additions back to false. There is only one small click when doing this.
The MaxPO in the footer takes about 1/4 second or so to update so if you
click on the button really quickly, you will get a repeat PO Numbers. You
can add a forced requery to remove the posibility of this or use the NEW
button in conjunction with a SAVE button to avoid this problem. Once you
know this is working, you can hide the footer.

Kelvin Lu
 
Back
Top