'Data Type Mismatch In Criteria Expression' error when using 'Count' in query Design; Help!

Discussion in 'Access' started by Mickaela Baker, May 15, 2016.

  1. Mickaela Baker

    Mickaela Baker

    May 15, 2016
    Likes Received:
    So, I have this VERY important database management assignment, which is currently driving me crazy. In the assignment, I am asked to run a number of queries, one of which is a count query. I did the usual : selected query design, chose my tables and fields, clicked the E-like symbol etc. After changing 'Grouped by' to 'Count', I wrote the criteria. I am supposed to count all sponsors from the Gold category. So under 'Category of Sponsor' I wrote 'gold' for the criteria. When I clicked Run, I received the error 'Data Type Mismatch in Criteria Expression'. I cannot, for the life of me, solve this problem. I've checked the data type for 'Category of Sponsor', and it IS text. Apparently, the quotation marks will mean its text, which it is, so what's the problem? Is Count only for numerical values?
    If so, how will I count this: upload_2016-5-15_9-56-58.png in order to receive how many times 'Gold' occurs under Category of Sponsor, and counting how many Gold sponsors I have?

    Here is my sql:
    SELECT Count(Sponsor.[Sponsor Name]) AS [CountOfSponsor Name]
    FROM Sponsor
    HAVING (((Count(Sponsor.[Category of Sponsor]))='gold'));

    Please explain to me like I'm a three year old, I'm a complete newb.
    Mickaela Baker, May 15, 2016
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.