Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Criteria/Crosstab Help 2

Status
Not open for further replies.

matthej

MIS
Mar 3, 2005
8
US
I have a basic query which feeds a crosstab query. In the base query I am able to make criteria selections either in the design view by "hard-coding" the selections or I can use a reference to a form to pick the criteria.

The problem arises from the secon option. If I use a reference to a form, the crosstab query won't run and says that it doesn't recognize the fields "Forms![formname].[controlname] as a valid field.

I must just have the syntax wrong here or something. Can anyone please let me know how to make that work? I eventually want to create a switchboard to select criteria instead of manually going in and changing the criteria myself.

Or....if there's no way to do that (because I need the crosstab query), is there an action/macro I can use that will first open up the base query, change the current criteria selection, save/close it, and then run the crosstab?

I would greatly appreciate any help you can provide....

Matt
 
Is the form OPEN when you try to run the crosstab query?

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
yes. I have form/switchboard open (called Test Switch), the base query open (and this adjusts as I change the criteria as it should), but the crosstab query won't open...I get the following error:
"The Microsoft Jet database engine does not recognize '[Forms]![Test Switch]![Combo10]' as a valid field name or expression."

Thanks for looking into this....

 
I think you need to "declare" the parameter.

In design view of the query, use the Query menu, select parameters, enther the whole form reference, and select appropriate datatype.

Roy-Vidar
 
HAH! It worked! I would never have thought to do that...Thanks so much. You have saved me hours of research!
thanks,

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top