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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
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 |