The form in question displays the contents of a purchase order. The Load event checks to see if the PO is new, i.e., whether to create it. (PO# = 0 => create) The Load event calls Procedure NewPO if needed to create a record in the PO table, changing the PO# to > 0. Then the Load event opens the PO table to the correct PO, new or not.
Under some extremely rare circumstances, NewPO may not be able to create a PO at the time. The new PO# is assigned by finding the biggest PO# currently in the table, locking that record, adding one to the PO#, inserting the new record, and unlocking the locked record. If another user tries to create another PO at the precisely correct moment, their attempt to lock will fail. (Maybe it's the precisely wrong moment? <g>) In that case, the PO# still = 0 so I display a message to the user, and do not open the PO form. The circumstances are obscure and have happened only twice in seven years that I'm aware of. (Over 50,000 POs have been created on this system during that time.)
It is true that I could create a procedure that does NewPO and OpenPO and then does form PurchaseOrder. But before I saw the need for this I wrote the code in the Load event. In the spirit of "don't mess with it more than you need to" I just wanted to modify the Load event.
That's the long story.
Thanks for your input,
Shanachie