A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Data type mismatch in criteria expression



 
 
Thread Tools Display Modes
  #1  
Old October 8th, 2004, 05:29 PM
Tcs
external usenet poster
 
Posts: n/a
Default Data type mismatch in criteria expression

I have a select query with only two fields that I want to use to get a count of
the second field, grouped by the first field:

Ward PropCode
---------- ----------
Group By Count

This runs fine when I do NOT specify what PropCode I want. As soon as I add
"AP" to the criteria, I get this error msg:

"Data type mismatch in criteria expression."

I'm using data from a linked table (DB2 UDB on AS400). I've done this about 2
months ago, and I had no problems. I've searched this NG for the same error and
it would seem I have a field with a Null, but I can't find any record with a
Null.

Anyone have any thoughts/ideas?

Thanks in advance,

Tom

  #2  
Old October 8th, 2004, 05:45 PM
HCJ
external usenet poster
 
Posts: n/a
Default

Hi tcs,
I think you need two instances of PropCode in the
query; one to Group By, and the second to Count. You only
have the second instance. Add the criteria to the Group
By instance.

Hope this helps.

-----Original Message-----
I have a select query with only two fields that I want to

use to get a count of
the second field, grouped by the first field:

Ward PropCode
---------- ----------
Group By Count

This runs fine when I do NOT specify what PropCode I

want. As soon as I add
"AP" to the criteria, I get this error msg:

"Data type mismatch in criteria expression."

I'm using data from a linked table (DB2 UDB on AS400).

I've done this about 2
months ago, and I had no problems. I've searched this NG

for the same error and
it would seem I have a field with a Null, but I can't

find any record with a
Null.

Anyone have any thoughts/ideas?

Thanks in advance,

Tom

.

  #3  
Old October 8th, 2004, 08:05 PM
John Spencer (MVP)
external usenet poster
 
Posts: n/a
Default

If AP is a property code, then you need to add PropCode to your query a second
time and change it to a WHERE and then put your criteria against that. Right
now, Access is complaining because is has no idea how to match a COUNT (a
Number) to "AP" (a string).

Ward PropCode PropCode
---------- ---------- ----------
Group By Count Where

In the SQL window that would look something like

SELECT WARD, Count(PropCode) as Expr1
FROM SomeTableName
WHERE PropCode = 'AP'
GROUB BY Ward



Tcs wrote:

I have a select query with only two fields that I want to use to get a count of
the second field, grouped by the first field:

Ward PropCode
---------- ----------
Group By Count

This runs fine when I do NOT specify what PropCode I want. As soon as I add
"AP" to the criteria, I get this error msg:

"Data type mismatch in criteria expression."

I'm using data from a linked table (DB2 UDB on AS400). I've done this about 2
months ago, and I had no problems. I've searched this NG for the same error and
it would seem I have a field with a Null, but I can't find any record with a
Null.

Anyone have any thoughts/ideas?

Thanks in advance,

Tom

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Data type mismatch in criteria expression Paul James Running & Setting Up Queries 5 September 8th, 2004 01:13 AM
Required Field Conditional Katherine R New Users 2 September 1st, 2004 05:52 AM
Data Type field Angel_G New Users 1 July 13th, 2004 11:49 PM
Mial merge data base problems Rachael Mailmerge 16 May 21st, 2004 06:22 PM
Importing from Excel to Access yolanda Worksheet Functions 2 May 13th, 2004 10:16 AM


All times are GMT +1. The time now is 12:38 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.