Crosstab query not recognize input date text box

Sokkheng

Member
Local time
Today, 14:19
Joined
Jul 12, 2023
Messages
40
I have create Crosstab query that source is get from the first query that have input Start Date and End Date get from my input form. when i run the crosstab query it show message : The Microsoft database engine does not recognize '[Forms]![frmNavigationForm].[Form]![txtStartDate]' as a valid filed name or expression.
But for the other select query is ok, it does't running only crosstab query.
What is my mistake in crosstab query?
Thanks for help
 
Check the links in the Similar Threads at the bottom of the page.
 
You probably have to declare the parameter in your crosstab query (at least, if not in both).
 
Form references in queries are always a bit problematic because Jet itself does not recognize objects such as Access forms. In some cases, Access resolves the content of a form control when passing the query to Jet, and Jet can do something with the substituted value.
However, in some cases (crosstab queries, parameters in subqueries, passing the query to DAO) this does not work. However, these internal reprocessings are not consistently implemented, the developer then has to get by and act without "Pampers".

There are several ways to pass parameters to queries. In a simple case, try using Eval in the query:
Code:
Forms.frmNavigationForm.Form.txtStartDate
=>
Eval("Forms.frmNavigationForm.Form.txtStartDate")
In the expression I removed the stupid superfluous brackets. Brackets used should have a meaning, which is not the case here.

Like I said, if that's not enough, there are other options.
 
Setting the parameter in the crosstab should solve the problem but always remember when using dates from unbound controls as parameters to set the format of the control to a date format so that the expression engine recognizes that you intend for the data to be a date.
 

Users who are viewing this thread

Back
Top Bottom