[AccessD] Alternatives to docmd.outputto

John W. Colby jcolby at colbyconsulting.com
Fri Dec 5 06:44:24 CST 2003


Yea, I was afraid of that.  I guess it's not that much of a stretch after
all, just adding select * from sometable where and tack on the filter.

John W. Colby
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Stuart
McLachlan
Sent: Thursday, December 04, 2003 11:28 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Alternatives to docmd.outputto


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.



_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list