"Data type mismatch in expression"

  • Thread starter Thread starter mohsin via AccessMonster.com
  • Start date Start date
M

mohsin via AccessMonster.com

Hi expert

I got this ""Data type mismatch in expression" error message while running my
queries.

SELECT qrymaxallca1.NE, qrymaxallca1.Date, Sum([qrymaxallca1]!
[TCAT_CALL_AMOUNT]) AS BHCA
FROM qrymaxallca1
WHERE (((([qrymaxallca1]![TCATID]))=34 Or (([qrymaxallca1]![TCATID]))=32 Or (
([qrymaxallca1]![TCATID]))=45 Or (([qrymaxallca1]![TCATID]))=16 Or ((
[qrymaxallca1]![TCATID]))=15 Or (([qrymaxallca1]![TCATID]))=13))
GROUP BY qrymaxallca1.NE, qrymaxallca1.Date;

Basically what i try to do is, to sum the value in call amount field base on
ID 34,32,45,16,15,13

Can you help me to recognised the error please.

- thank you
 
What is the TCATID field type?
If its a text field you need to add double quote before and after the value.

Also, you can make this SQL shrter using In

SELECT qrymaxallca1.NE, qrymaxallca1.Date, Sum([qrymaxallca1]!
[TCAT_CALL_AMOUNT]) AS BHCA
FROM qrymaxallca1
WHERE [qrymaxallca1]![TCATID] In (34,32,45,16,15,13)
GROUP BY qrymaxallca1.NE, qrymaxallca1.Date

And if it a text field
SELECT qrymaxallca1.NE, qrymaxallca1.Date, Sum([qrymaxallca1]!
[TCAT_CALL_AMOUNT]) AS BHCA
FROM qrymaxallca1
WHERE [qrymaxallca1]![TCATID] In ("34","32","45","16","15","13")
GROUP BY qrymaxallca1.NE, qrymaxallca1.Date
 
Thanks cohen

After recheck in the table properties, the TCATID is text, what is need is
"number" type.

-thank you

Ofer said:
What is the TCATID field type?
If its a text field you need to add double quote before and after the value.

Also, you can make this SQL shrter using In

SELECT qrymaxallca1.NE, qrymaxallca1.Date, Sum([qrymaxallca1]!
[TCAT_CALL_AMOUNT]) AS BHCA
FROM qrymaxallca1
WHERE [qrymaxallca1]![TCATID] In (34,32,45,16,15,13)
GROUP BY qrymaxallca1.NE, qrymaxallca1.Date

And if it a text field
SELECT qrymaxallca1.NE, qrymaxallca1.Date, Sum([qrymaxallca1]!
[TCAT_CALL_AMOUNT]) AS BHCA
FROM qrymaxallca1
WHERE [qrymaxallca1]![TCATID] In ("34","32","45","16","15","13")
GROUP BY qrymaxallca1.NE, qrymaxallca1.Date
Hi expert
[quoted text clipped - 15 lines]
- thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top