简体   繁体   中英

data type mismatch when comparing dates in MS-Access

I have dates stored in an MS-Access table in the 'General Date' format.

I'm trying to create a query that returns records between a specific date range (all records from March 2010) however I encounter a 'data type mismatch in critera expression' message.

Here is my statement;

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 have tried variations on the date format (mm/dd/yyyy, dd/mm/yyyy 00:00:00)

访问日期的分隔符是#:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM