Flitering

  • Thread starter Thread starter AJOLSON
  • Start date Start date
A

AJOLSON

I have a Query that I use in a form that I apply filters to. . The filter
works correctly as I am looking at the results on the form.
The problem is that this filter does not apply to other queries that are
baced
on the the filtered query used on the form. How do I get all 'Sub"Queries to
relfect the applied filter?


THanks
Andy
 
If I understand you correctly, you have a form that's based on a query in
your database (for example, "qryRecordSource"). Within your form, you are
applying filters. However, you have other forms that are also using
"qryRecordSource" as well, and you want the filter to apply to all forms. Is
that correct?

If so, you need to apply your filtering to the actual query and not the
form. The Filter on the form is form-specific.

There are different ways to do that. You can re-create the SQL Statement
that makes up the query:

Dim qry as DAO.QueryDef
Set qry = CurrentDb.QueryDefs("qryRecordSource")
Set qry.SQL = "....SQL Statement Here which includes a revised Where
clause..."
qry.Close

me.Refresh (to refresh the form, or Forms("formname").Refresh if this code
is not within the Form's Class Module).

Alternatively, you could create parameters within your Query and update the
parameters accordingly. If you want to do this approach, you should further
investigate parameters within queries.

Steve
 
Back
Top