Error 2498

S

swedbera

Hi,

I have a parameter query that works if I run it directly, but I am getting
this error message when I run it from code:

"An expression you entered is the wrong data type for one of the arguments."

I've seen other posts referring to this error, but they don't apply to this
scenerio. Can someone tell me what would cause this?

Arlene
 
A

Allen Browne

Arlene, declare the parameter(s) if you have not already done so.

In query design view, choose Parameters on the Query menu.
Enter the paramters and their data type in the dialog, one per line.

If that does not solve the problem, are you applying criteria on a
calculated field? If so you need to typecast the calculation. See:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html

If the parameters are picking up values from a control on the form, it also
helps to specify the Format of the control.

If that does not solve the problem, post the SQL statement of the query (SQL
View on View menu.)
 
S

swedbera

Thank you Allen!

Allen Browne said:
Arlene, declare the parameter(s) if you have not already done so.

In query design view, choose Parameters on the Query menu.
Enter the paramters and their data type in the dialog, one per line.

If that does not solve the problem, are you applying criteria on a
calculated field? If so you need to typecast the calculation. See:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html

If the parameters are picking up values from a control on the form, it also
helps to specify the Format of the control.

If that does not solve the problem, post the SQL statement of the query (SQL
View on View menu.)
 
Top