Date Range

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query that asks users for a date range.It asks the users to put in
a starting date and also asks the user to put an ending date. The query works
fine but the only problem withthe query is that when I enter the same date in
the date range it does not return any records. (Like if I want to get today's
records only) I want the query to return records when I enter the same
starting and ending date.
 
I have a query that asks users for a date range.It asks the users to put in
a starting date and also asks the user to put an ending date. The query works
fine but the only problem withthe query is that when I enter the same date in
the date range it does not return any records. (Like if I want to get today's
records only) I want the query to return records when I enter the same
starting and ending date.

You are probably storing a Time value in the field, (the date was
entered using Now() instead of Date()).
A Date of 6/16/2005 11:15:00 AM is not the same as a Date of
6/16/2005.

Either enter the next day as the end date, or enter a time value as
well as the date, i.e. 6/16/2005 23:59:59 as the ending date.

Alternatively, get rid of the time value stored in the field if you
don't need it for other purposes.
 
What is the filter that you put in the query

If you use
[Paramdate1] and <[ParamDate2] Then try
=[Paramdate1] and <=[ParamDate2]
Or
between [Paramdate1] and [ParamDate2]
 
Michael:
Do your queries include the equal signs in the less-than and greater-than.
i.e.
([DateFieldInTable] >= [Enter Start Date]) and ([DateFieldInTable] <= [Enter
End Date]) ? If one of the equal signs is not there, you would get the
result you are stating you are getting.
 
Try:

....
WHERE ([DateField] >= [Enter Start Date:])
AND ([DateField] < DateAdd("d", 1, [Enter End Date:])

It is liklely that you have non-zero time component in your values and in
this case:

[A Specific Date] + [A Non-zero Time] > [A Specific Date]
 
my filter is a follows:
=[PLEASE ENTER STARTING DATE] And <=[PLEASE ENTER ENDING DATES]
I even tried the following
Between [PLEASE ENTER STARTING DATE] And [PLEASE ENTER ENDING DATES]

I got the same results. I want I found out is that the date field also
stores time. Is the a function or any way to get rid of the timein the date
field?
 
my filter is a follows:
=[PLEASE ENTER STARTING DATE] And <=[PLEASE ENTER ENDING DATES]
I even tried the following
Between [PLEASE ENTER STARTING DATE] And [PLEASE ENTER ENDING DATES]

I got the same results. I want I found out is that the date field also
stores time. Is the a function or any way to get rid of the timein the date
field?

fredg said:
You are probably storing a Time value in the field, (the date was
entered using Now() instead of Date()).
A Date of 6/16/2005 11:15:00 AM is not the same as a Date of
6/16/2005.

Either enter the next day as the end date, or enter a time value as
well as the date, i.e. 6/16/2005 23:59:59 as the ending date.

Alternatively, get rid of the time value stored in the field if you
don't need it for other purposes.

Permanently remove the time value?

Run an Update query.

Update YourTable Set YourTable.[DateField] = Int([DateField]);

Change YourTable and DateField to whatever the actual names of the
table and field are.

In gthe future, use =Date() to enter a date, not =Now().
 
Back
Top