Hi this is my first post here.
I have this linked table query from a OBDC and I need to be able to filter out specific dates in that query. The dates in the table were in text format and I converted the dates using the CDate function. I wanted to filter the query to a single date and always I get the Datatype mismatch in criteria expression error.
However, filtering dates does work only when there are other specifications in the criteria fields (e.g. if I specify a date and and name).
This really frustrating and I'm at my limit here :banghead:
My SQL code in error looks like this:
SELECT
purch_hist.PUITM AS ITEM,
purch_hist.PUPO AS PO,
purch_hist.PUQTY AS QTY_RECEIVED,
CDate([purch_hist.PURDT]) AS RECEIPT_DATE,
itmcnt.ITBYR AS BUYER,
purch_hist.PUCST AS UNIT_COST,
vendor.NVNO AS VENDOR NO,
vendor.NVNM AS VENDOR,
purch_hist.PUCOMM AS COMMODITY
FROM
itmcnt INNER JOIN (purch_hist INNER JOIN NewVend ON purch_hist.PUVEN = NewVend.NVNO) ON itmcnt.ITITM = purch_hist.PUITM
GROUP BY
purch_hist.PUITM,purch_hist.PUPO, purch_hist.PUQTY, CDate([PURDT]), itmcnt.ITBYR,
purch_hist.PUCST, NewVend.NVNO, NewVend.NVNM, purch_hist.PUCOMM
HAVING (((CDate([purch_hist.PURDT]))=#6/16/2014#))
Thanks in advance!
P.S. This query works fine with a non converted date field, however the dates I need are in text format and need to be converted since I do not have permissions to edit the tables.
I have this linked table query from a OBDC and I need to be able to filter out specific dates in that query. The dates in the table were in text format and I converted the dates using the CDate function. I wanted to filter the query to a single date and always I get the Datatype mismatch in criteria expression error.
However, filtering dates does work only when there are other specifications in the criteria fields (e.g. if I specify a date and and name).
This really frustrating and I'm at my limit here :banghead:
My SQL code in error looks like this:
SELECT
purch_hist.PUITM AS ITEM,
purch_hist.PUPO AS PO,
purch_hist.PUQTY AS QTY_RECEIVED,
CDate([purch_hist.PURDT]) AS RECEIPT_DATE,
itmcnt.ITBYR AS BUYER,
purch_hist.PUCST AS UNIT_COST,
vendor.NVNO AS VENDOR NO,
vendor.NVNM AS VENDOR,
purch_hist.PUCOMM AS COMMODITY
FROM
itmcnt INNER JOIN (purch_hist INNER JOIN NewVend ON purch_hist.PUVEN = NewVend.NVNO) ON itmcnt.ITITM = purch_hist.PUITM
GROUP BY
purch_hist.PUITM,purch_hist.PUPO, purch_hist.PUQTY, CDate([PURDT]), itmcnt.ITBYR,
purch_hist.PUCST, NewVend.NVNO, NewVend.NVNM, purch_hist.PUCOMM
HAVING (((CDate([purch_hist.PURDT]))=#6/16/2014#))
Thanks in advance!
P.S. This query works fine with a non converted date field, however the dates I need are in text format and need to be converted since I do not have permissions to edit the tables.
Last edited: