Unanswered: server query date range filter question
Hi guys. Im trying to figure out how to add a date range filter to my database query. I want to be able to enter a date into ("E,6") and have VBA pull data >,= to that date range according to my "OPENED_DATE" dates. My code is pasted below:
'Get Cost Center Info for each part number listed
y = 1
x = 1
row_cnt = 2
While (Trim(AppWrkBk.Worksheets("Sheet1").Cells(y, x).Value) <> "")
ITEM_VAL = Trim(AppWrkBk.Worksheets("Sheet1").Cells(y, x).Value)
SQLStr = "SELECT ITEM, SFC, OPERATION, NC_CODE, OPENED_DATE_TIME, NC_CODE_DESCRIPTION, RESOURCE, PGM, COMMENTS FROM IDSOPS..NC_RPR WHERE ITEM = '" & ITEM_VAL & "' ORDER BY ITEM, OPENED_DATE_TIME"
oRs.Open SQLStr, oCn
If Err.Number <> 0 Then
Msg = "Error # " & str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Err.Description
MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext
MsgBox "Cannot execute statement " & SQLStr & " Exiting execution."
While (Not oRs.EOF)