Sunday, February 19, 2012

Data type mismatch in criteria expression.

I am using access 2000 database and getting the following error:

Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.

The quiry is:
"SELECT AffID, Date, Hits, Payment, Commission, Paid, Sum(Hits) AS HitsTotal, Sum(Payment) AS PaymentTotal, Sum(Commission) AS CommissionTotal, Sum(Paid) AS PaidTotal, Commission - Paid AS Balance from earned WHERE earned.Date Between #"& startDate &"# and #"& endDate &"# AND AffID='"& AffId &"' GROUP by AffID, Date, Hits,Payment, Commission, Paid order by Date ASC"

Both AffID and Hits are number fields; Payment, Commission and Paid are currency fields; and Date is Date/Time field. While trying both AffID and date range get posted from the forms to the page having this script but still error is there. I tried hard but in vain. I would appreciate the help in getting rid of this error. ThanksDont put quotes around your AffID in your where clause. your code should be "AND AffID=" & AffID & " Group by"......
not "AND AffID='"& AffId &"' GROUP by"

Just remove the single quotes

No comments:

Post a Comment