T
Timothy via AccessMonster.com
I have an ACCESS 2003 passthrough query to a SQL server that works great. It
has the date ranges hard coded into it. I need to pass the dates from a form
into this query. I have seen several posts that seem to address this issue,
but I can't make them work. I am still relatively new to this, so any help
would be greatly appreciated. The SQL that is working is as follows:
Select ACT.transactionNumber AS [Transaction#], OM.outletNumber AS [Outlet#],
OM.outletName AS [Outlet Name], Convert(DATETIME,CONVERT(CHAR(10),ACTS.
dispatchDateTime,101)) AS [Dipsatch Date], ACT.assignedContactUserName AS
[Created By], UPPER(LTRIM(RTRIM(CCE.firstName))) As [First Name], UPPER(LTRIM
(RTRIM(CCE.lastName))) AS [Last Name], OM.locationMasterID
FROM CCE_ContactCtr_V3_Reporting.dbo.OUTLET_MASTER OM,
CCE_ContactCtr_V3_Reporting.dbo.ACTIVITY ACT, CCE_ContactCtr_V3_Reporting.dbo.
ACTIVITY_SUPPORT ACTS, CCE_ContactCtr_V3_Reporting.dbo.ACTIVITY_TYPE ACTT,
CCE_ContactCtr_V3_Reporting.dbo.CCEUSER CCE
WHERE OM.outletNumber = ACT.outletNumber AND ACT.transactionNumber =
ACTS.transactionNumber AND ACT.activityTypeValue = ACTT.activityTypeValue and
ACT.assignedContactUserName = CCE.userName AND ((ACT.closeDateTime between
{ts '2007-05-21 00:00:00'} and {ts '2007-06-03 00:00:00'}) AND (ACT.
activitySourceLD = 'S') AND (ACT.activityTypeValue = 'PMR'))
has the date ranges hard coded into it. I need to pass the dates from a form
into this query. I have seen several posts that seem to address this issue,
but I can't make them work. I am still relatively new to this, so any help
would be greatly appreciated. The SQL that is working is as follows:
Select ACT.transactionNumber AS [Transaction#], OM.outletNumber AS [Outlet#],
OM.outletName AS [Outlet Name], Convert(DATETIME,CONVERT(CHAR(10),ACTS.
dispatchDateTime,101)) AS [Dipsatch Date], ACT.assignedContactUserName AS
[Created By], UPPER(LTRIM(RTRIM(CCE.firstName))) As [First Name], UPPER(LTRIM
(RTRIM(CCE.lastName))) AS [Last Name], OM.locationMasterID
FROM CCE_ContactCtr_V3_Reporting.dbo.OUTLET_MASTER OM,
CCE_ContactCtr_V3_Reporting.dbo.ACTIVITY ACT, CCE_ContactCtr_V3_Reporting.dbo.
ACTIVITY_SUPPORT ACTS, CCE_ContactCtr_V3_Reporting.dbo.ACTIVITY_TYPE ACTT,
CCE_ContactCtr_V3_Reporting.dbo.CCEUSER CCE
WHERE OM.outletNumber = ACT.outletNumber AND ACT.transactionNumber =
ACTS.transactionNumber AND ACT.activityTypeValue = ACTT.activityTypeValue and
ACT.assignedContactUserName = CCE.userName AND ((ACT.closeDateTime between
{ts '2007-05-21 00:00:00'} and {ts '2007-06-03 00:00:00'}) AND (ACT.
activitySourceLD = 'S') AND (ACT.activityTypeValue = 'PMR'))