Question

I'm trying to use the delete command in Access using the shown specifications, but Access keeps saying "Data type mismatch in criteria expression." Does anyone know what to do?

DELETE ORDERS.OrderDate, ORDERS.CustomerID
FROM ORDERS
WHERE (((ORDERS.OrderDate)='2008-01-24') AND ((ORDERS.CustomerID)="C0003"));
Was it helpful?

Solution

DELETE ORDERS.OrderDate, ORDERS.CustomerID, * FROM ORDERS WHERE
(((ORDERS.OrderDate)=#1/24/2008#) AND ((ORDERS.CustomerID)=3));

OTHER TIPS

Dates in Access are surrounded by hash-signs #

WHERE (((ORDERS.OrderDate)=#2008-01-24#) AND ((ORDERS.CustomerID)="C0003"));

Are you sure Orders.OrderDate is a date/time data type ? If not try :-

DELETE ORDERS.OrderDate, ORDERS.CustomerID
FROM ORDERS
WHERE (((cdate(ORDERS.OrderDate))>#2008/01/24#));

Try doing a SELECT query, and trying each one of those criteria seperately. If that DATE field is really a date/time, you'll need the # signs before and after.

SELECT ORDERS.OrderDate, ORDERS.CustomerID
FROM ORDERS
WHERE (ORDERS.OrderDate)="#1/24/2008#";

SELECT ORDERS.OrderDate, ORDERS.CustomerID
FROM ORDERS
WHERE (ORDERS.CustomerID)="C0003";

If either of them bomb then you can at least narrow down which piece isn't working and we can focus there.

Try this

DELETE ORDERS.OrderDate, ORDERS.CustomerID
FROM ORDERS
WHERE ORDERS.OrderDate = #01/24/2008# AND ORDERS.CustomerID = "C0003"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top