Unload, Close, Deactivate. Which event is best?

G

Gabby Girl

Good afternoon

Hoping for some quidance as to which event to use for an append query to a
temp table.

A little background:
Currently the users enter all purchase order info via a main form (with PO
Nbr and supplier info, etc..) and the purchase order details get entered into
the subform. The user enters amount ordered, amount received and a
calculated field shows whether there are any backorders or not. If there are
any backorders, once they are received the user goes back into the Purchase
order and changes the amount received. All this works fine except we have no
idea as to when the backorder was received and on which supplier ref nbr.
They now want to track when the backorder was received, on what supplier ref
nbr, qty etc...

I was thinking that if there are any backorders, the backorder info could
get copied to a temp table and when the backorders are received the user
could bring up the ones he/she needed and update the backorder qty received
with date received etc...

What I'm not sure of is where to put the code to do this. Should it be on
the OnUnload event, or OnClose or somewhere else?

Could someone please help me with this?

As always, any assistance/wisdom is greatly appreciated.

Thanks kindly
 
J

John W. Vinson

What I'm not sure of is where to put the code to do this. Should it be on
the OnUnload event, or OnClose or somewhere else?

None of the above, I'd say! What if the user has multiple orders to enter
(each of which might contain one or more backordered items)? The form might
not GET closed.

Without knowing the mapping from the form to the subforms, or what gets put
into the backorder table, all I can suggest is the mainform's AfterUpdate
event (fires when each mainform record - the order? - is written to disk), or
a command button Save.

Do be aware that the mainform record is saved whenever the user sets focus to
any subform control, and that each subform record is saved when you either
move to another record or to the mainform - I'm guessing you know that, but
the lurkers might not.
 
G

Gabby Girl

Hi John,

Thanks very much for your reply & expertise.

I reread my question after I had posted it and gave my head a good shake and
thought to myself "My God girl where is your head at?" To explain a little
further, there is a hidden check box (labeled LineComplete) in the subform
(continuous) that is marked true (via code) if there are no backorders. Once
that PO details are entered the user can either press "cmdAdd" to add a new
PO or "cmdClose" to exit PO's. When the User presses either of these
buttons, if all records in the subform are marked true LineComplete then a
check box on the main form (labeled POComplete) is marked true. I of course
can add the code to both of those cmd buttons to copy the records for that PO
that aren't marked complete to the temp table and then carry on from there.
I hope I didn't get too long winded.

I really do appreciate you taking the time to help and if there is a
better/easier way to do this I would welcome any advice you can give me.

Again Thanks and have a great evening
 

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