Help my query please....

  • Thread starter Thread starter HM
  • Start date Start date
H

HM

Hi,
I have query like this but I always got an error:
"Data type mismatch in criteria expression"
Here is my query:
SELECT Sum(IIf(Val([dbo_cum].[age])<13,1,0)) AS age1
FROM dbo_cum;
(age field is text field)
Thanks in advance,
HM
 
You may be getting caught by null values in column
[dbo_cum].[age]

try ...

Sum(IIf(iif(isnull([dbo_cum].[age]),0,Val([dbo_cum].[age]))
<13,1,0))
 
Oh yeah, you are right. It working now...
Thanks a lot.
HM
-----Original Message-----
You may be getting caught by null values in column
[dbo_cum].[age]

try ...

Sum(IIf(iif(isnull([dbo_cum].[age]),0,Val([dbo_cum]. [age]))
<13,1,0))




-----Original Message-----
Hi,
I have query like this but I always got an error:
"Data type mismatch in criteria expression"
Here is my query:
SELECT Sum(IIf(Val([dbo_cum].[age])<13,1,0)) AS age1
FROM dbo_cum;
(age field is text field)
Thanks in advance,
HM


.
.
 
HM,

I can see nothing wrong with your expression. Is there nothing else
in the query? E.g. a criteria entry?

Try this variation...
SELECT Abs(Val([age])<13) AS age1
FROM dbo_cum

- Steve Schapel, Microsoft Access MVP
 
Back
Top