Apply filter to Query

G

Guest

I have a form button with VBA code that sets up a filter (strFilter), opens
my report and applies the filter to my report:

With Reports![LocationsReportbyStorage]
.Filter = strFilter
.FilterOn = True
End With

This works great. But, I also have a chart in the same report, but the
chart's data source is a different query than the query the report uses. I
can't use the same query because I need to use Group by and avg in the
chart's query SQL. How can I use the same filter (strFilter) that I've
already set up and apply it to my query called ChartQuery in the VBA Code?

Thanks -
 
D

David Lloyd

Alex:

One way would be to dynamically build the query behind chart using the
filter fields.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


I have a form button with VBA code that sets up a filter (strFilter), opens
my report and applies the filter to my report:

With Reports![LocationsReportbyStorage]
.Filter = strFilter
.FilterOn = True
End With

This works great. But, I also have a chart in the same report, but the
chart's data source is a different query than the query the report uses. I
can't use the same query because I need to use Group by and avg in the
chart's query SQL. How can I use the same filter (strFilter) that I've
already set up and apply it to my query called ChartQuery in the VBA Code?

Thanks -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top