Robert
robert at servicexp.com
Thu Jun 26 06:20:55 CDT 2008
Thanks Susan, I will look further into it.. WBR ~Robert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Susan Harkins Sent: Wednesday, June 25, 2008 5:45 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Filter Main Form with Subform... > So I guess from what your saying is that I need to look at using SQL to > filter the main forms query? How would I apply that SQL to the existing > query in the main form? If you could not tell I don't know much about > SQL. > :-( ========Use the subform's Double Click event (or the After Update, whatever works best, I just like the Double Click in a subform) to force the main form to requery, using the subform's value as the filtering criteria: Dim strSQL As String strSQL = "SELECT * FROM table WHERE criteriafield = " & subform.Value Forms!mainform.RecordSource = strSQL A couple of things -- don't forget to add string delimiters if needed: strSQL = "SELECT * FROM table WHERE criteriafield = '" & subform.Value & "'" Forms!mainform.RecordSource = strSQL And that relies on the subform's value equaling the criteria value, which it might not -- you'll have to accommodate for that. But this is just one way -- lots of ways and I think using the subform's parent and child link properties to specify the main form is probably easier and might have the same results. Susan H. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com