Data type mismatch when comparing dates in MS-Access

I have dates stored in an MS-Access table in a Common Date format.

I am trying to create a query that returns records between a specific date range (all records since March 2010), however I am encountering the message "data type mismatch in the criterion expression".

Here is my expression;

SELECT Loan.loan_datetimeLeant, product_name, [product_artist/director], product_category, loanItem_cost FROM Loan INNER JOIN ((Product INNER JOIN Ite ON Product.[product_id] = Item.[product_id]) INNER JOIN Loan_Items ON Item.[item_id] = Loan_Items.[item_id]) ON (Loan.[cust_id] = Loan_Items.[cust_id]) AND (Loan.[loan_datetimeLeant] = Loan_Items.[loan_datetimeLeant]) WHERE Loan.loan_datetimeLeant >= '01/03/2010' AND Loan.loan_datetimeLeant <= '31/03/2010' ORDER BY Loan.loan_datetimeLeant; 

I tried date format options (mm / dd / yyyy, dd / mm / yyyy 00:00:00)

+4
source share
1 answer

the separator for access dates is #:

 WHERE Loan.loan_datetimeLeant >= #03/01/2010# AND Loan.loan_datetimeLeant <= #03/31/2010# 
+10
source

Source: https://habr.com/ru/post/1309347/


All Articles