Skip to content
Advertisement

Displaying a Crosstab Query with a Parameter as Subform Source Object

Ok Access 2010 here.

I have a crosstab, lets call it “TestCrosstab,” that has a parameter to access a form control in the query it uses as a reference. It looks like this:

It’s source query, as seen above, is called “TestQuery,” and it looks like this:

They both work great when the user enters a number into the form control “TextDaysPast” and you manualy run the queries in a “pop-up.”

What I am trying to do is attach the crosstab above as a source object of a subform purely for display purposes. In VBA, after the user inputs a number into “TextDaysPast,” this line, among others, is called to attach the crosstab to the subform:

Upon entering a number into “TextDaysPast” and executing the query with a command button, the form appears to work correctly (no errors) except the crosstab never displays. If I change the source query to a static “WHERE,” the crosstab would lose it’s need for “PARAMETERS” and displays normally as a subform source object. Something in using “PARAMETERS” does not allow the crosstab to be displayed.

Any ideas on how to get around this? Would combining the source query and crosstab into one big monster fix this?

Thank you for your input!

Advertisement

Answer

You cannot refer to a cross tab with a parameter in a subform, as far as I know. However, you can build the query in VBA, this eliminating the need for a parameter and update the sql of the cross tab query referenced by the subform.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement