The general idea is to set the RecordSource property of Subform2 to
select the one record that matches the record in Subform1. When a record
is selected in the control on Subform1, attach a procedure to its
"AfterUpdate" event to select the record in Subform2. It would look
something like:
Sub Subform1ControlName_AfterUpdate()
Forms!NameOfMainForm!NameOfSubform2.Form.RecordSou rce = _
"SELECT * FROM NameOfTableOrQuery WHERE OwnerID = " _
& Forms!NameOfMainForm!NameOfSubform1.Form! ControlNameInSubform1
End Sub
This selects the one record in Subform2 that matches the OwnerID
selected in Subform1. Donīt forget that if the OwnerID is text then you
need to modify the SQL slightly to read :
Forms!NameOfMainForm!NameOfSubform2.Form.RecordSou rce = _
"SELECT * FROM NameOfTableOrQuery WHERE OwnerID = ī" _
&Forms!NameOfMainForm!NameOfSubform1.Form! ControlNameInSubform1 &"ī"
I hope this helps.
--
Andy Briggs
Elmhurst Solutions Limited
http://www.elmhurstsolutions.com
Posted via
http://dbforums.com