Passing SQL statment into recordsource for a report

lman

New member
Local time
Yesterday, 21:18
Joined
Feb 22, 2011
Messages
9
I have a report that will be used to display different data but in the same format. I have successfully created a report that will dynamically change the controls (field names, data sources, etc) based on the fields brought in by various crosstab queries. I wanted to go one step further and intsead of storing the queries themselves simply store the SQL statment in a table and have the report pull whichever SQL statement is needed from that table and use it as the recordsource.

The problem I seem to be running into is that whenever I set the recordsource of the report to a the SQL statment I get an error stating that I "cannot use the crosstab of a non-fixed column as a subquery". HOWEVER if I set the recordsource as the name of the pre-built query it works like a charm

For Example

THIS WORKS FINE




v_report_query = Queryname (name of an actual pre-built query)
me.recordsource = v_report_query






THIS DISPLAYS THE ERROR




v_report_query = "actual SQL string from the Query"
me.recordsource = v_report_query







I have this in the on_open event of the report
 
when you are calling the report to be open write the where condition for it
 

Users who are viewing this thread

Back
Top Bottom