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

Comparison Operators/BETWEEN clause

Status
Not open for further replies.

chris6976

Technical User
Mar 4, 2003
28
GB
I have the following WHERE clause, to retrieve data between AND INCLUDING 2 dates:

WHERE (((Calls.Date_Time)>=#1/1/2003# And (Calls.Date_Time)<=#3/3/2003#));

Data is pulled from 1/1/03 to 2/3/03, but not from the 2nd date specified.

Any suggestions as to why the <= operator does not work?
(It also does not work without the BETWEEN statement)

Im sure its very simple, I just cant spot it!!

Thanks
 
The time part of the second date is not being included since you are only checking for the date part. There are a number of ways to accomplish but the simpliest for your case is to include the time on the second date variable.

WHERE (((Calls.Date_Time)>=#1/1/2003# And (Calls.Date_Time)<=#3/3/2003 23:59:59#));
 
I have modified the above SQL so that data is queried with respect to two text boxes (which contain DATE values).
I again have the same problem with regard to the BETWEEN statement.

For example to use the dates 01/01/2003 BETWEEN 08/03/2003
(01/01/2003 >= AND <= 08/03/2003), this selects only the data from 01/01/2003 to 07/08/2003.

Does anybody have any idea as to how to retrieve the data ON the 2nd date as well? It must surely be possible!?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top