Anonymous
Anonymous asked in Computers & InternetProgramming & Design · 1 decade ago

Type mismatch error in access table?

I created and access database with a front end and a backend contianing the tables. in the back end when I open the table and try to sort some columns will sort some will not sort. and when i try to run a simple query based on that table I get a "Type Mismatch in expression" I have check all my data types in all the tables and they match. If anyone can suggest and area to look at the help would be apprciated.

1 Answer

Relevance
  • 1 decade ago

    That error usually comes up when you are comparing a different data type in the "Where" condition of your query.

    Sample 1: If the field is a number

    Select * From Table1 Where NumberField = '0' << This will generate an error

    It should be Select * From Table1 Where NumberField = 0

    Sample 2: If the field is a Date/Time

    Select * From Table1 Where DateTimeField = '01/01/2009' << This will generate an error

    It should be Select * From Table1 Where DateTimeField = #01/01/2009#

    This error will also show up if you are using computations as an expression but each field has a different data type

Still have questions? Get your answers by asking now.