QUERY DATE RANGE

H

hotrod1952

I AM A NEWBIE: I am writing a query in Access97 to pull data in between two
dates. The expression I am using is: Between [ #"START DATE dd/mm/yy"# ]
And [#"END DATE dd/mm/yy" #] in the critera field. The result is pulling all
dates from START DATE and only the first entry in the END DATE. I want to
include all entries for the END DATE.
 
A

Allen Browne

Presumably this expression is in the Criteria row of query design,
underneath a field that is a Date/Time field. If this field contains a time
component, the final day (i.e. the day that matches your END DATE) will not
be included, because the time is after the beginning of that day. To work
around that, ask for less than the next day.

I'm really not too sure about the # and quote marks in the parameter names.
Try:
= [START DATE] AND < DateAdd("d", 1, [END DATE])

To ensure Access understands them, declare your parameters. In query design
view, choose Parameters on the Query menu. Enter 2 rows in the dialog: the
same name as you used in the Criteria row, and Date for the type in the 2nd
column, i.e.:
START DATE Date/Time
END DATE Date/Time

Since you live in a d/m/y country, you might also get some help to ensure
Access understands your dates correctly from this article:
International Date Formats in Access
at:
http://allenbrowne.com/ser-36.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

hotrod1952 said:
I AM A NEWBIE: I am writing a query in Access97 to pull data in between
two
dates. The expression I am using is: Between [ #"START DATE dd/mm/yy"# ]
And [#"END DATE dd/mm/yy" #] in the critera field. The result is pulling
all
dates from START DATE and only the first entry in the END DATE. I want
to
include all entries for the END DATE.
 
C

command_lt

You can do this by putting in on end date 1-13-06 11:59:59 pm this should
take care of that day. It sounds like you field includes both date and time
 
H

hotrod1952 via AccessMonster.com

I had already declared the parameters. Your solution worked perfectly. Thanks
Everyone!


Allen said:
Presumably this expression is in the Criteria row of query design,
underneath a field that is a Date/Time field. If this field contains a time
component, the final day (i.e. the day that matches your END DATE) will not
be included, because the time is after the beginning of that day. To work
around that, ask for less than the next day.

I'm really not too sure about the # and quote marks in the parameter names.
Try:
= [START DATE] AND < DateAdd("d", 1, [END DATE])

To ensure Access understands them, declare your parameters. In query design
view, choose Parameters on the Query menu. Enter 2 rows in the dialog: the
same name as you used in the Criteria row, and Date for the type in the 2nd
column, i.e.:
START DATE Date/Time
END DATE Date/Time

Since you live in a d/m/y country, you might also get some help to ensure
Access understands your dates correctly from this article:
International Date Formats in Access
at:
http://allenbrowne.com/ser-36.html
I AM A NEWBIE: I am writing a query in Access97 to pull data in between
two
[quoted text clipped - 4 lines]
to
include all entries for the END DATE.
 
Top