The important factor that you need to take into consideration is that you need to generate the order number AFTER the user has entered all the information. Presumably they don't need the order number until they are done creating the details for it. The problem you are having is that a second user can hit the page after a previous user but before that previous user has saved the data. This results in the same order number being generated twice. So you need to create the order number when you save the data to the database. This should eliminate the duplicate problems.
However, something you've said doesn't make sense. You say the purchase order number is "autonumber". If it's an autonumber, then you shouldn't be needing to create it because the database will. And the DB should only create it when you insert new data which is essentially the solution I described above.
Peter
------------------------------------------------------
Work smarter, not harder.
|