I need to add the parameters [StartDate] and [EndDate] to an SQL Pass-through query. Currently my SQL is as follows:
- SELECT POORDHDR_SQL.ord_no AS 'PO Number', TIMEDIM_SQL.BusinessDate AS 'PO Issue Date', TIMEDIM_SQL.Monthname AS 'PO Month', TIMEDIM_SQL_1.BusinessDate AS 'Requested Date', TIMEDIM_SQL_2.BusinessDate AS 'Promised Date', TIMEDIM_SQL_3.BusinessDate AS 'Receipt Date', APVENFIL_SQL.vend_no, APVENFIL_SQL.vend_name
-
FROM DATA.dbo.APVENFIL_SQL APVENFIL_SQL, DATA.dbo.POORDHDR_SQL POORDHDR_SQL, DATA.dbo.POORDLIN_SQL POORDLIN_SQL, DATA.dbo.TIMEDIM_SQL TIMEDIM_SQL, DATA.dbo.TIMEDIM_SQL TIMEDIM_SQL_1, DATA.dbo.TIMEDIM_SQL TIMEDIM_SQL_2, DATA.dbo.TIMEDIM_SQL TIMEDIM_SQL_3
-
WHERE POORDLIN_SQL.ord_no = POORDHDR_SQL.ord_no AND POORDHDR_SQL.ord_dt = TIMEDIM_SQL.MacolaDate AND POORDLIN_SQL.request_dt = TIMEDIM_SQL_1.MacolaDate AND POORDLIN_SQL.promise_dt = TIMEDIM_SQL_2.MacolaDate AND POORDLIN_SQL.receipt_dt = TIMEDIM_SQL_3.MacolaDate AND APVENFIL_SQL.vend_no = POORDHDR_SQL.vend_no
I have read that Access does not handle parameters in Pass-Through Queries in the same way as it handles parameters in other types of queries.....I have found this to be the case. I have tried to DECLARE @StartDate datetime, @EndDate datetime and adding TIMEDIM_SQL.BusinessDate Between [@StartDate] And [@EndDate] in the WHERE clause but I get syntax errors....