VBA in forms

K

Kathryn

I am trying to get certain information from one table to be automatically
entered into another table with the option of storing other information with
it. This is to keep a log of certain orders which are rushed.

I am trying to get information like customer and product (which would take
unnecessary time to manually enter) to be filled in when the work order
number (wo_no) is entered in the form. Then the person can enter the other
information like when the new due date is and the person who was the contact
in.
I have to say I am a novice at VBA.

Right now I have entered into the ON Exit event:
Private Sub wo_no_Exit(Cancel As Integer)
Dim varcustomer_po_no, varcustomer_cd, varcustomer_name, varplant_no,
varproduct_cd, varproduct_name, varstart_qty As String
varcustomer_po_no = DLookup("custmer_po_no", "'open_wo", "wo_no = [wo_no]")
varcustomer_cd = DLookup("customer_cd", "'open_wo", "wo_no=[wo_no]")
varcustomer_name = DLookup("customer_nm", "'open_wo", "wo_no = [wo_no]")
varplant_no = DLookup("plant_no", "'open_wo", "wo_no = [wo_no]")
varproduct_cd = DLookup("product_cd", "'open_wo", "wo_no = [wo_no]")
varproduct_name = DLookup("product_description", "'open_wo", "wo_no
=[wo_no]")
varstart_qty = DLookup("start_qty", "'open_wo", "wo_no = [wo_no]")
If (Not IsNull(varcustomer_po_no)) Then Me![customer_po_no] =
varcustomer_po_no
If (Not IsNull(varcustomer_cd)) Then Me![customer_cd] = varcustomer_cd
If (Not IsNull(varcustomer_name)) Then Me![customer_name] = varcustomer_name
If (Not IsNull(varplant_no)) Then Me![plant_no] = varplant_no
If (Not IsNull(varproduct_cd)) Then Me![product_cd] = varproduct_cd
If (Not IsNull(varproduct_name)) Then Me![product_name] = varproduct_name
If (Not IsNull(varstart_qty)) Then Me![start_qty] = varstart_qty

End Sub

but this keeps bringing up the information of the very first wo that I put
in. It is not renewing with every wo order.

How can I fix this?
 
Top