'Data type mismatch in criteria expression' error in Count query

  • Thread starter Thread starter Al
  • Start date Start date
A

Al

Hi,
I'm new to Access so be gentle with me ;-) I'm currently doing a project
where I need to count the number of cities (in a 'City' field) which meet
particular city names. I've done a count query with the city name in the
criteria, but all I get is an error saying 'Data type mismatch in criteria
expression'. I'm not sure what I'm doing wrong as the City field is text and
I'm typing the city name correctly.
Any help would be appreciated.
Thanks
Al
 
If you're building the SQL statement directly, then you need to delimit the
city name value with ' characters:

SELECT Count(*)
FROM TableName
WHERE City = 'City Name';

The above applies as well when you create and apply any type of filter to a
query that does not have criterion in it.

If you're entering the city name in the Criteria: box while in the design
view of the query, then ACCESS usually will delimit the value with "
characters:
"City Name"

Tell us more details about how you're "doing" the query.
 
Back
Top