Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Master Form with Subforms

Status
Not open for further replies.

TomLon

Technical User
Jul 19, 2002
48
0
0
US
I have a master form (frmMasterForm)with two subforms: The first subform is labled Companies (off of query qryCompanies with the key being CompNo). This form is set as a tabular form (created from the wizard) where you can select the records in a tabular format. My second subform is Contacts (I am sure that you can see where I am going with this now) that will show the contacts for the selected company. It is built on the query qryContacts. There is a field labeled CompNo in this query that the criteria is set to

[Forms]![Companies]![CompNo]

Now I can have the form Companies opened and a particular record selected. I can run the qryContacts query and it returns that proper data. However, if I attach the subform Contacts and try to open the Master form, it prompts me for a value of Forms!Companies!CompNo (I presume from my qryContacts query off of the field CompNo). Could someone please point out what I have done wrong?

Thanks
 
The criteria in qryContacts for CompNo should be:
[Forms]![frmMasterForm].Form![Companies]![CompNo]

Have a look here:


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
OK, that worked perfectly. As I said, the both of these subforms are created in a tabular format. For instance, if I select a partaciular company name, it will list the contacts in the Contacts subform. Now with the Company subform being a tabluar format, you have a record selector (a triangular pointer) pointing to the selected record on to the left of the record. I put a 'requery' command on the 'OnClick' event of the CompanyName field. It then requeries the contact subform when the CompanyName field is clicked (works correct). However, if someone clicks on the triangular record selector and selects the record that way, it does not requery. Which control's OnClick property would I select for this to work?

Thanks
 
I'd try the Current event procedure.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top