Form Question

  • Thread starter Thread starter JP
  • Start date Start date
J

JP

I have two tables, one called backlog, one called orders.

Inside orders there is billing and shipping info, contact
info, and a Customer purchase order field (CPO).

In Backlog there is product info, quantity and orderID,
CPO, and Invoice ID.

I made a form for the orders using a subform to input
backlog items. I linked the forms using master/child of
OrderID.

I want to be able to grab the CPO from the main form and
insert it into the line item as soon as I finish entering
the line item. I also want to do the same thing for an
invoice order form.
 
Why do you need to store the CPO value in two tables? Because the two tables
are linked, you can always obtain the CPO value when running a query/report
by including both tables in the query and having them linked/joined.

Stoing the data twice is very rarely necessary to do.

Otherwise, to do what you seek, you could use the subform's BeforeUpdate
event to get the value of the CPO field from the main form and write it into
the subform's field for CPO:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.CPOField = Me.Parent.CPOField
End Sub
 
Back
Top