Stuart McLachlan
stuart at lexacorp.com.pg
Thu Dec 4 22:27:56 CST 2003
On 4 Dec 2003 at 23:06, John W. Colby wrote: > I just noticed that this method of creating a file from a report doesn't > have a property for filters for the report. I have a reporting system that > builds up a complex filter then opens the report and applies the filter. > Obviously I can't do this with the docmd.outputto. Any alternatives that > will allow me to (for example) output a normal report (with the filter > applied) to a rtf/snapshot/excel file etc.? > I've never been able to. As a workround, I've done this sort of thing before: 1. Create a Static Function: Static Function RecordSourceStore (Optional SourceString As String) As String Dim strTemp As String If SourceString > "" Then strTemp = SourceString End If rsource = strTemp End Function 2. Where you build your filter, build the full SQL string instead and set the static variable: strSource = "Select * from myTable Where " & strFilter strSource = RecordSourceStore(strSource) 3. Set the Report recordsource in the report On_Open event Me.RecordSource = RecordSourceStore() -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support.