Save report, w/ conditions as a file

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

I need to create a file of a report to store and recall at
a later date. My report needs to use the condition
argument to call the right data. It appears that
the "Output to" comand does not allow the use of the
filter. How would you save a report as a file if you need
to use a condition?

Thanks. Rick
 
One approach is to declare a public string variable at the top of a standard
module:
Dim strReportFilter As String
and then use the Open event procedure of the report to apply that string as
the filter:

Private Sub Report_Open(Cancel As Integer)
If Len(strReportFitler) > 0 Then
Me.Filter = strReportFilter
Me.FilterOn = True
strReportFilter = vbNullString
End If
End Sub


Set the string before exporting the report:
strReportFilter = "([State] = ""WA"") AND ([Inactive] = False)"
DoCmd.OutputTo ...
 
Back
Top