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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a Query Form to filter a Master Form & its Subform

Status
Not open for further replies.

SockMonkey

IS-IT--Management
Mar 6, 2000
41
US
THE PROBLEM: I can't seem to apply a filter to a subform if I want to limit it to certain criteria. I can apply a filter to the Master form with now problem<br>
<br>
<br>
BACKGROUND: I have created a Master form with my Property Data (frmProperty) that includes an unbound subform that is linked by default to the sfrmTenantList (Tenant Summary information in datasheet view) but can be changed with the click of a button to sfrmTenantDetails (Tenant Detail information in single form view).<br>
I have also created an unbound form with unbound fields and code to collect the values entered and create an SQL string and use that string to filter the records on the Master Form and potentially the detail subform.<br>
<br>

 
So<br>
You want to choose a certain set of records?<br>
There are several other ways of doing this.<br>
1. Create a VBA SQL code statement and pass it to the Subforms recordsource.<br>
<br>
' Initialize SELECT statement.<br>
MyRecordSource = &quot;SELECT * FROM [PhoneLog] WHERE [MyID] = &quot; & Me![MyID]<br>
' set record source to Subform<br>
Me![YOURsubform].Form.RecordSource = MyRecordSource<br>
<br>
2. Use the Master/Child link in the subform.<br>
<br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Doug<br>This helped part of my problem , but not all of it.<br><br>I am able to use the query form to filter the records on the main for to a specific group.<br>For example I start with 146 records and only want records for Property Name &quot;Plaza 9&quot; which filters me to 33 records.<br><br>However, Of these 33 records I only want to see the ones which have detail history in the subform with activity date greater than 3/1/2000.&nbsp;&nbsp;By using your method of changing the RecordSource for the subform i could limit the visible records to the ones matching my criteria, but I still had 33 main form records still visible that I had to scroll through to find the 9 records that had the relevant activity.<br>All I want to see is the 9 main records that have Property Name &quot;plaza 9&quot; with subform details having activity date&nbsp;&nbsp;greater than 3/1/2000.<br><br>I have tried so many programming permutations to get this to work that my brain is near meltdown.Help!<br>Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top