Error 2498

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.)
 
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.)
 
Back
Top