Filter form to select a report

lisa1965

New member
Local time
Today, 13:46
Joined
Sep 26, 2007
Messages
9
I have a form that asks the user for some report filters (Customer, Year). And I would like this filter form to be used on about 20 reports. I was hoping if someone can tell me if there is a way to allow the user to select the report to filter on. I am using the following code to execute the report filters and want to know if it is possible to have an unbound object linked to a list of reports and then use that parameter in the following code rather than the report name Reports![AccidentsPerJobTitle]

' Combine criteria strings into a WHERE claus for the filter
strFilter = "[ClientName] " & strClient & " AND [DateYear] " & strYear

' Apply the filter and switch it on
With Reports![AccidentsPerJobTitle]
.Filter = strFilter
.FilterOn = True
End With

Any help would be appreciated, thanks Lisa
 
Reports in a List Box

I found a post to show me how to list my reports in a list box on my filter form, but I don't know how to change the code to use that report. Can anyone help?

' Build criteria string for Report field
strDocName = Me.cboReport.Value

' Apply the filter and switch it on
With Reports!strDocName
.Filter = strFilter
.FilterOn = True
End With
 
I'm using a Where clause instead of a filter, but my code to launch the report looks like this:

DoCmd.OpenReport stDocName, acPreview, , stWhere

stWhere is Dimmed as a string and the value of stWhere is set by code as you have set the value of the filter in your code.

I know this is long after you posted, but hope others will find this useful.
 

Users who are viewing this thread

Back
Top Bottom