Access Data Type Mismatch Error

Anonymous
2022-10-22T19:04:41+00:00

Hi I have an Access Database that has worked well in the past and it now has an error I can't figure out how to fix. The error reads "Data Type Mismatch in Criteria Expression"

Please help me figure this out.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

28 answers

Sort by: Most helpful
  1. George Hepworth 22,215 Reputation points Volunteer Moderator
    2022-10-23T21:27:56+00:00

    In addition to John's concerns about generic fields with "Short Text" datatype, I see a number of aggregates in that SQL, which are likely to be the source of the current problem. If you try to sum a field or calculate on a field with a null in one record, that's the error you get. I really do encourage you to look at the data in addition to the SQL. It may not be the source of the problem. But unless you rule it in -- or rule it out -- we can't know for sure.

    0 comments No comments
  2. Tom van Stiphout 40,086 Reputation points MVP Volunteer Moderator
    2022-10-23T21:33:40+00:00

    Looks like a table without a PK. That's a bad idea.

    Also too many text fields where a more appropriate data type like Currency or Date/Time should be used.

    0 comments No comments
  3. Anonymous
    2022-10-23T23:31:20+00:00

    What do you mean my PK?

    0 comments No comments
  4. Anonymous
    2022-10-23T23:34:50+00:00

    SELECT [Pieces/Minifigs/Sets].Condition, [Pieces/Minifigs/Sets].[Item Description], Sum([Pieces/Minifigs/Sets].Qty) AS Qty, Sum([Pieces/Minifigs/Sets].Total) AS Total, Count([Pieces/Minifigs/Sets].Total) AS [Lot Qty], [Pieces/Minifigs/Sets].[Item Type], [Pieces/Minifigs/Sets].[Item Number]

    FROM [Pieces/Minifigs/Sets]

    GROUP BY [Pieces/Minifigs/Sets].Condition, [Pieces/Minifigs/Sets].[Item Description], [Pieces/Minifigs/Sets].[Item Type], [Pieces/Minifigs/Sets].[Item Number]

    ORDER BY Count([Pieces/Minifigs/Sets].Total) DESC;

    I understand that the datatypes could be better I am only after a small percentage of this info. I am trying to consolidate the information down to these 7 columns and I think those datatypes are correct. Maybe I'm wrong but thought that the others didn't have to be correct.

    0 comments No comments
  5. Anonymous
    2022-10-23T23:38:39+00:00

    The data its looking at is like this.
    Image I am trying to consolidate the items to get the seven columns of data I want.

    If you know of a better way to consolidate the info, I'm all ears.

    0 comments No comments