Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sequence Function HELP!!!!!

Status
Not open for further replies.

PLK3541

IS-IT--Management
Mar 29, 2005
60
US
I have a database for Purchase orders and I would like for the PO # to be the next number in sequence when the form opens. I used auto number for PO ID the Primary Key. I am not sure how to code the sequence function or what event to put expression. I tried to use a DMax function but the code doesn’t look like it is working.

= DMax("[PO Number]", "Purchase Order", "PO Number")+1

Where "PO Number" is the Field name I want to put the number in
and "Purchase Order" is the Table name.


Any help
 
Provided you're in single user:
= DMax("[PO Number]", "[Purchase Order]") + 1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Will I run into trouble if it is for multiple users? Will it change when new user opens form? I have to say that I am a beginner, so any and all ideas are welcome.

Thanks
 
I placed this expression = DMax ("[PO Number]", "[Purchase Order]") + 1 in the Default Value of the Textbox: PO Number properties with no success. The #Error will populate the textbox and not a number. I need to insert the next record number into the textbox with a new record. The Field name is PO Number and data type is number. The next number should be taken from the [Purchase Order] Table.


Welcom any ideas

Thanks
 
you will incur the wrath, ire and displeasure of the relational db gurus using the DMax function. Multiple users can ==> WILL try the trick at 'the sametime'. This WILL generate duplicate 'keys'.

see faq 700-184



MichaelRed


 
Thanks you guys for responding with helpful tips, I do appreciate the assistance with my issue. I have not been able to locate faq 700-184 in Access Forms FAQ Index. If you know the title or handle that might help.

If I could get the PO Number to increment with the PO ID I will be almost home with this project. If the DMax function is not the way to go, any suggestion how to code this form to have the PO Number move in sequence with the PO ID that is the primary key autonumber.

Thanks

Pat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top