Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date comparison issue 1

Status
Not open for further replies.

btween

Programmer
Aug 7, 2003
338
US
I have a set of dates that I need to compare and I've tried a few different methods but nothing seems to work.

The recordset value comes from an MS SQL database set to smalldatetime, so a printout of a date value would be:

7/12/2004 10:45:00 AM

I tried the following comparison methods but nothing seems to work:

Code:
if datevalue(rsODN("Transaction_Date")) >= "05/04/2004" and datevalue(rsODN("Transaction_Date")) <= "11/21/2004" then 
pr = "$29.95"
end if

if datevalue(rsODN("Transaction_Date")) >= "#05/04/2004#" and datevalue(rsODN("Transaction_Date")) <= "#11/21/2004#" then 
pr = "$29.95"
end if

if datevalue(rsODN("Transaction_Date")) >= "'05/04/2004'" and datevalue(rsODN("Transaction_Date")) <= "'11/21/2004'" then 
pr = "$29.95"
end if

Any suggestions on making a correct comparison are greatly appreciated.


 
Try it without the quotes, just as a straight-up date.

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top