Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data type mismatch in criteria expression in my totals query

Status
Not open for further replies.

tvsmvp

Technical User
Aug 17, 2006
59
US
I'm getting the infamous "Data type mismatch in criteria expression" in my totals query. The field causing the trouble is created in a separate query by simply adding the values of other fields like so:

Score: Str([Count1]+[Count2]+[Count3]+[Count4]+[Count5]+[Count6])

From what I can glean from other users (on this forum) with the same error message, it has something to do with the field ("Score") being formatted as text rather than number or vice versa. But everything I've tried brings up the same error.

Suggestions?
 
What is the WHERE clause of your totals query ?

BTW, why using the Str function ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Er... the "str" function shouldn't have been there - it was left over from one of many attempts (read: stabs in the dark) to convert the data. Please disregard the "str" function, that has since been removed.

I haven't put in a "where" - I've been trying "max" just to get it to output any info. Should I be using "where"?
 
But of course, here ya go:

SELECT KeyWordsInArticlesCount.Keyword, Max(KeyWordsInArticlesCount.Score) AS MaxOfScore
FROM KeyWordsInArticlesCount
GROUP BY KeyWordsInArticlesCount.Keyword;

 
Is by chance KeyWordsInArticlesCount a query too ?
Seems the error lies here, so, what's its SQL code ?
 
Hey - I (actually we) got it to work. When you requested the SQL code, something caught my eye as I pasted it - and I noticed that I was (mistakenly) dealing with errors by alternating between

IIf([Expr1]>0 ...
and
IIf([Expr3]<>"" ...

Setting them all to the latter fixed the issue.

Thanks for walking me through the solution!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top