Reputation: 4539
Is there a way to reference a form's combo/text box within the query like a select query?
I usually use something like this in a select query's criteria:
like forms!frmMain.qTitleofSomething&* (access adds the brackets for me)
but this does not work in a crosstab query?? which I just found out. is there a way to accomplish the same kind of parameter control without setting up multiple crosstabs?
Upvotes: 2
Views: 5265
Reputation: 91356
You need to add a parameter to the query if you wish to reference a form You can do this by right-clicking in the query design window or by typing it into the SQL view. You should end up with something on the lines of:
PARAMETERS [Forms]![frmA]![Field1] Short;
TRANSFORM Count(tblA.ID) AS CountOfID
SELECT tblA.Field2, Count(tblA.ID) AS [Total Of ID]
FROM tblA
WHERE tblA.Field1=[Forms]![frmA]![Field1]
GROUP BY tblA.Field2
PIVOT tblA.Field1;
Short refers to the data type of the field. The types are included in a drop down list available from right-clicking in the query design window and selecting Parameters.
Upvotes: 10