View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Gary Sakaguchi Gary Sakaguchi is offline
external usenet poster
 
Posts: 1
Default Calculating a date within the OLE DB query

Within my OLE DB query, I would like to use a calculated date for the
selection criteria. I'm using Excel to create a summary report against a
SQL database. Completion date is one of the fields, I only want to select
those records that are completed on/after the Monday three weeks ago, NOW() -
((WEEKDAY(NOW(),3)) + 21). The report shows the prior three weeks, plus the
current week's information.

Copy of the OLE DB query - I would like to replace the "10/10/2005" with the
calculated date.

SELECT reqID, reqDate, fName, lName, inputTbl.userInput, adminsTbl.admFname,
completeDate FROM requestsTbl, userTbl, InputTbl, adminsTbl WHERE
(requestsTbl.reqDate LIKE '%2005%') AND completeDate '10/10/2005' and
requestsTbl.userID = userTbl.userID AND requestsTbl.userInputID =
inputTbl.userInputID AND (requestsTbl.assignedTo LIKE adminsTbl.adminID)
ORDER BY completeDate, admFname, reqID

Thanks,

Gary Sakaguchi