Different results for same dates in query

J

Jimmy

I have a query and one fields is a calculated date field.
Now in the criteria I would like the user to input the
date range. In the past I have used

Between [Start Date:] And [End Date:]

This gives me the incorrect number of records.
The only way I have found to get this to work properly is
by hard coding the date in the using

Between #11/1/2003# And #11/28/2003#

Why would the two result in different number of records
when the same dates are used? I would like to turn this
database over to the users in the future and I don't want
them to have to go in and change the dates in the query.

Thanks
 
A

Allen Browne

The problem is probably with the interpretation of the query parameters as
dates.

In query design view, choose Parameters on the Query menu.
Enter your two parameters, specifying the data type:
[Start Date:] Date/Time
[End Date:] Date/Time

If you are working in a country that has a different date format to the USA,
you may get further help from:
International Dates in Access
at:
http://allenbrowne.com/ser-36.html
 
G

Guest

Thanks for the quick reply. I set up the parameters like
you posted and now it works great.

Thanks again,
Patrick

-----Original Message-----
The problem is probably with the interpretation of the query parameters as
dates.

In query design view, choose Parameters on the Query menu.
Enter your two parameters, specifying the data type:
[Start Date:] Date/Time
[End Date:] Date/Time

If you are working in a country that has a different date format to the USA,
you may get further help from:
International Dates 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.

I have a query and one fields is a calculated date field.
Now in the criteria I would like the user to input the
date range. In the past I have used

Between [Start Date:] And [End Date:]

This gives me the incorrect number of records.
The only way I have found to get this to work properly is
by hard coding the date in the using

Between #11/1/2003# And #11/28/2003#

Why would the two result in different number of records
when the same dates are used? I would like to turn this
database over to the users in the future and I don't want
them to have to go in and change the dates in the query.


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top