update table with form and subform

J

JIM

I want to create a work order file from a form that calls up a client
name(from tblCustomers) with a combo box on the main form and calls up the
building name from a related table(tblBuildings) on a sub form. If I open
the subform alone the building names appear but if frmWorkOrders is opened
only the controls on the main form show-all the fields on the subform are
blank. I have searched help and the discussions but don't understand enough
yet to ask an intelligent question. I written an invoicing system but have
never updated an underlying table with a subform. Is there a primer or
article somewhere on doing this?
Thanks, JIM
 
R

Rick Brandt

JIM said:
I want to create a work order file from a form that calls up a client
name(from tblCustomers) with a combo box on the main form and calls
up the building name from a related table(tblBuildings) on a sub
form. If I open the subform alone the building names appear but if
frmWorkOrders is opened only the controls on the main form show-all
the fields on the subform are blank. I have searched help and the
discussions but don't understand enough yet to ask an intelligent
question. I written an invoicing system but have never updated an
underlying table with a subform. Is there a primer or article
somewhere on doing this?
Thanks, JIM

The subform CONTROL on the main form has two properties MasterLink and
ChildLink. These should contain the names of fields (or possibly controls in
the case of the MasterLink) that are common between the two sets of data. That
is what causes the subform to display records that are related to the current
record in the parent form. It is also what causes any new records created in
the subform to be automatically related to the current parent record by copying
those linked values into the new subform record.

If you have these properties set incorrectly, then the "filter" applied to the
subform could cause zero records to show.
 
J

JIM

Thanks Rick. The combo box has control source as CustomerName, a primary key
in tblCustomers; on the subform both Link Child Field and Link Master Field
are CustomerName. This is exactly the same way my invoicing system uses
these tables and it works fine.
I read in discussions last night the main form should be related to the 1
table, in 1 to many relationships, and the subform should be related to the
many table. My main form is related to the tblWork Orders, a many table and
the subform is related to tblBuildings, also a many table. They are both
related to tblCustomers thru the primary key in tblCustomers, CustomerName.
This is what is happening: when the form is first opened the main form is
populated with a info from tblCustomers via the combo box, the subform is
blank. If form is closed and reopened the original customer info is still in
the form (wherever I left off navigating) and the subform is populated with
the correct info from tblBuildings but if navigation happens the
corresponding buildings are not updated in the subform. Just the original
Customer's buildings show. There must be a method of refreshing subform on
main form load and afterupdate of control box. I just don't how to go about
it.
Thanks, JIM
 

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