filtering charts from DoCmd.OpenReport

krisleech

Registered User.
Local time
Today, 10:16
Joined
Nov 28, 2002
Messages
36
I can create a button which opens report and filters the data using the 'Where' parameter of the DoCmd.OpenReport function:

example:
Code:
    Dim stDocName As String
    Dim strWhere As String


    strWhere = "[Date] Between #" & [start date] & "# And #" & [end date] &
"#"
    stDocName = "Trend Analysis - Demographics v Service (Quality Report)"

    DoCmd.OpenReport stDocName, ,, , strWhere


This works fine for text reports, but for charts the data is not filtered.
Is there any way to apply a filter to charts when opening the report from a button.

Many thanks Kris.
 
You need to set the criteria within the embedded chart's recordsource.
 
dynamic criteria for charts

Is it possible to do that from an on click event. ie. open the report and set the criteria.
The reason for this the charts must display a certain date range, so the user enters the start and end dates in edit boxes and when open report button clicked the report opened which contains the charts, populated with data between [start date] and [end date].

Many thanks Kris.
 
You need to set these date parameters in the query that the chart is based on, not the actual report's recordsource.

(Think of the chart as a report within a report)

When you open the report you should be prompted to enter these values.
 

Users who are viewing this thread

Back
Top Bottom