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 variable that has 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 store the name of the query itself in the variable it runs like a charm.



For Example

Code:
 
v_report_query = Queryname (name of an actual pre-built query)
me.recordsource = v_report_query
THIS WORKS FINE

Code:
 
v_report_query = "actual SQL string from the Query"
me.recordsource = v_report_query
THIS DISPLAYS THE ERROR

I have this in the on_open event of the report