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

Why do I have to add 1 to the todate of a query to get all

Status
Not open for further replies.

ToyFox

Programmer
Jan 24, 2009
161
US
Wierd happening. I have a date field in a query and a form with two text boxes for date from and date to that are parameters to the query. For instance, if I want all records for December up to today, I I have to add 1 to the end date or go 12/1/2009 and 12/22/2009 as the date params.
I have seen this before but not lately. What am I doing wrong.
 



Can you see the actual SQL that runs, when you enter these parameters?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
if your date field is an date time field 12/21/2009 will give you just till 12/21/2009 12:00:00 am
 
it is a date/time field. Thanks for the response.
 
But keep in mind that if you enter all dates as just the date then even though there is a time component, you shouldn't need to add 1, ie, each date you would be entering into the table as the date plus 12:00 AM.

This is how it normally works so it looks like the data is getting entered with the time--possibly using a Now() function...
--Jim
 
Couldn't you also pull the data based on DateValue([Date field])? I believe I have used this in the past to make some queries ignore time data even if it's there.

Cheryl dc Kern
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top