M
Mike Wilson
Dear all,
I'm having difficulty trying to figure out what is causing the error "Data
type mismatch in criteria expression" in my Access .MDB.
Don't be put off - but I have a Visual Studio 2005 solution which queries an
Access database, and this error is sometimes thrown, and sometimes not. It
appears that this depends on what data is inside the database, but I can't
seem to pin down what precise data causes this scheme style error to be
thrown. I have managed to reproduce this error entirely in Access.
The code is:
SELECT Subcontractor_ID, SUM(Gross) AS Gross, SUM(DirectCostOfMaterials0dp)
AS DirectCostOfMaterials0dp, SUM(TotalAmountDeducted) AS
TotalAmountDeducted, SUM(Net) AS Net FROM (Payment) WHERE (PaymentDate >=
#01/01/2000#) AND (PaymentDate < #01/03/2008#) AND (Company_ID = 15) AND
(MonthlyReturn_ID IS NULL OR MonthlyReturn_ID = '') GROUP BY
Subcontractor_ID
I assume that this is something to do with the dates, but no matter how I
format it - it still doesn't work. I've put a copy of this mdb online, which
can be downloaded at: http://tinyurl.com/35kkoz (1.67mb).
All the data has been overwritten & fakes, but should work. The query is in
the database too.
Please help, as I'm tearing my hair out!
Mike
I'm having difficulty trying to figure out what is causing the error "Data
type mismatch in criteria expression" in my Access .MDB.
Don't be put off - but I have a Visual Studio 2005 solution which queries an
Access database, and this error is sometimes thrown, and sometimes not. It
appears that this depends on what data is inside the database, but I can't
seem to pin down what precise data causes this scheme style error to be
thrown. I have managed to reproduce this error entirely in Access.
The code is:
SELECT Subcontractor_ID, SUM(Gross) AS Gross, SUM(DirectCostOfMaterials0dp)
AS DirectCostOfMaterials0dp, SUM(TotalAmountDeducted) AS
TotalAmountDeducted, SUM(Net) AS Net FROM (Payment) WHERE (PaymentDate >=
#01/01/2000#) AND (PaymentDate < #01/03/2008#) AND (Company_ID = 15) AND
(MonthlyReturn_ID IS NULL OR MonthlyReturn_ID = '') GROUP BY
Subcontractor_ID
I assume that this is something to do with the dates, but no matter how I
format it - it still doesn't work. I've put a copy of this mdb online, which
can be downloaded at: http://tinyurl.com/35kkoz (1.67mb).
All the data has been overwritten & fakes, but should work. The query is in
the database too.
Please help, as I'm tearing my hair out!
Mike