Linking Subforms - Help!

BillH

New member
Local time
Today, 11:53
Joined
May 1, 2002
Messages
9
Okay - I think I've seen similar problems on the board and I've tried a few suggestions but no luck so far.
I have 2 subforms on the same form. The 1st subform, "Broker Listing" is in datasheet view with multiple broker names. The 2nd subform is "Broker Details" which is in form view and contains the name, address, phone#'s for the corresponding broker in "Broker Listing". I want to be able to select a broker in "Broker Listing" and have the associated info (name, address, phone#) appear in "Broker Details".
Here's what I have:
2 tables - "Contacts" and "Brokers". "Contacts" has a "ContactID" field (key), "Brokers" has a "ContactID" and "BrokerID" (key) field. The main form is from the "Contacts" table and the 2 subforms are from the "Brokers" table. The "Broker Listing" subform has "ContactID" as the master and child link and the the "Broker Details" subform has "BrokerID" as the master/child link.
Any help or suggestions would be greatly appreciated.
 
This question comes up remarkably often. Look up 'synchronize records between two forms' in Access Help.
 
Thanks David. I grabbed the following code from the help area: Private Sub Form_Current()
Dim strCond As String
strCond = "BrokerID = Forms!BrokerList!BrokerID"
' Use the IsLoaded function from the Northwind
' sample database to check whether the Products
' form is open, then set the properties.
If IsLoaded("BrokerDetail") Then
Forms![BrokerDetail].FilterOn = True
Forms![BrokerDetail].Filter = strCond
End If
End Sub

This works perfectly using 2 separate forms but I cannot get to work using 2 subforms (on the same form). Code appears to run fine - the BrokerDetail form simply doesn't update.
Any thoughts?
THANK YOU
 
Might try strCond = "BrokerID = " & Forms!BrokerList!BrokerID
 
just wondering if the master/child link is wrong for Broker Details subform i.e. the Main form doesn't seem to have the link field (brokerID) from what you have said. Also, in your code you have:
Forms!BrokerList!BrokerID

I'm not sure what the normal way to do it is but I would normally write
Forms!Contacts!BrokerList.Form!BrokerID if I wanted to refer to a control on a subform.

[This message has been edited by naygl (edited 05-05-2002).]
 

Users who are viewing this thread

Back
Top Bottom