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!

Relate one subform to another

Status
Not open for further replies.

asjohnson

Technical User
Mar 8, 2001
15
0
0
US
I have one form that contains two somewhat related subforms (not directly related with Master and Child links). The top subform displays names of contacts in a continuous form format. The bottom subform contains ONE name and address for the selected record in the top subform.

What I want to accomplish is when a user selects a particular record in the top subform, the data in the bottom subform is refreshed (ie select a contact above and the correct address will be reflected below).

I have both subforms linked to separate queries as the record source. Any ideas on how to requery the bottom (address) subform?
 
Hello there!
Well pretty much regardless of how the links are, you should be able to requery the second subform in an event (in Visual Basic) on the main form with:

Me![NameOfSecondSubFormAsSeenByTheMainForm].Requery

similar in an event off of the first subform (for your case):

Me.Parent![NameOfSecondSubFormAsSeenByTheMainForm].Requery

Depending on your set up, I would suspect the "On Current" event of the "Top SubForm", but if it hangs, hit Ctrl+Break to stop it, then End if warned, and let me know... :)

Gord
ghubbell@total.net
 
Hi Gord, thanks for the interest.

I guess the real question is what is the best link. The key in this example is that the link between the two subforms is based on the ContactID (when a record on the top form is selected, the bottom form will requery/filter based on the ContactID value). Since the bottom form is not a sub form of the top subform, I cannot use the Master/Child link.

How does the top form send the ContactID to the bottom form's record source?

Should I requery the bottom form in the TopForm_Current Event? Or is there a way to filter the bottom form based on the top form's ContactID value?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top