I created two date fields: StartDate and Enddate. I backtested each new date field and they calculated and displayed correctly when displaying the detailed transactions. However, when I try to summarize in the query design tools transactions between StartDate and Enddate, I get an error message: Data type mismatch in criteria expression. Here's the SQL:
SELECT [SALESREP_12-22-2015].MBRID, [SALESREP_12-22-2015].FileCreationDate, CDate([FileCreationDate]-362) AS StartDate, CDate([FileCreationDate]+1) AS EndDAte, dbo_TransactionHistory.ReportDate, dbo_TransactionHistory.WklyTotalGDC AS SY_SALES INTO Tbl_Metrics_Test
FROM dbo_TransactionHistory LEFT JOIN [SALESREP_12-22-2015] ON dbo_TransactionHistory.AdvisorNo = [SALESREP_12-22-2015].MBRID
WHERE ((([SALESREP_12-22-2015].MBRID)=12345) AND ((dbo_TransactionHistory.ReportDate) Between "StartDate" And "Enddate"));SALESREP
What am I missing?
SELECT [SALESREP_12-22-2015].MBRID, [SALESREP_12-22-2015].FileCreationDate, CDate([FileCreationDate]-362) AS StartDate, CDate([FileCreationDate]+1) AS EndDAte, dbo_TransactionHistory.ReportDate, dbo_TransactionHistory.WklyTotalGDC AS SY_SALES INTO Tbl_Metrics_Test
FROM dbo_TransactionHistory LEFT JOIN [SALESREP_12-22-2015] ON dbo_TransactionHistory.AdvisorNo = [SALESREP_12-22-2015].MBRID
WHERE ((([SALESREP_12-22-2015].MBRID)=12345) AND ((dbo_TransactionHistory.ReportDate) Between "StartDate" And "Enddate"));SALESREP
What am I missing?