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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

>= or <= in a VBA SQL statement 1

Status
Not open for further replies.

Zygor

Technical User
Apr 18, 2001
271
US
I'm creating a user input screen where the user can input a date range as a criteria of a report. The following is what I'm using. It partially works.

strCriteria = "[dtDateRun] <= #" & CDate(Me.txtDateToUse) & "#"

It gets all the records where it's less than, but not the equals to.


Any thoughts?
 
Try this...

strCriteria = "[dtDateRun] <= #" & CDate(Me.txtDateToUse) & " 23:59:59 PM#
 
Oops...sorry...try this...

strCriteria = "[dtDateRun] <= #" & CDate(Me.txtDateToUse) & " 11:59:59 PM#
 
Eureka!

That was it. Thanks!

Have a star!
 
Another way:
strCriteria = "Int([dtDateRun])<=#" & CDate(Me!txtDateToUse) & "#"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top