Use SQL statement as basis for Report

pungentSapling

NeedHotSauce?
Local time
Today, 06:30
Joined
Apr 4, 2002
Messages
115
I have built a wonderful form that generates custom SQL statements.... These statements can then be used to make queries. The idea was to generate a custom report based on the SQL statement.

I thought I could just put the SQL string into a variable and then use a custom built function to return the SQL string. I built said function....
I put the function call in the recordsource for the Report....but to no avail! It says it cant find the query or table on which to base the report.

I have spent a lot of time making this sql generator form...It is making perfect statements.... I would really like to be able to use it.

Any one know how to use an SQL statement that is stored in a variable as the recordsource for a report?

thanks
p
 
p,

Use the OnOpen event of the report and:

Me.RecordSource = Forms![Main]![HiddenField]
or
Me.RecordSource = SomeFunction()

Wayne
 
thanks Wayne.....worked like a charm.
 
Hey - would you be willing to provide a copy of this form? I have created an add-in that creates filters for any report with either a table or query for a recordset. It sounds like your form would be a nice complement with mine.
 

Users who are viewing this thread

Back
Top Bottom