Criteria For Date Range

S

steve goodrich

I have 2 date fields on my form

"date from" and "date to"

I have a parameter query setup so I can list by a date

Date From Date To

<=[enter date] >=[enter date]

Not sure how that works but it does (I enter the date when prompted in the
"date from" box and the query runs showing starting and ending dates for
every row.



How should I enter the criteria if I want to select a date range. E.g date
from 1/1/07 to 14/1/07



Many Thanks



Steve
 
R

Rick Brandt

steve said:
I have 2 date fields on my form

"date from" and "date to"

I have a parameter query setup so I can list by a date

Date From Date To

<=[enter date] >=[enter date]

Not sure how that works but it does (I enter the date when prompted
in the "date from" box and the query runs showing starting and ending
dates for every row.

That query might run and return records, but it is not working as you expect.
If you enter the exact same parameter marker multiple times in a query to Access
that is ONE parameter that will have its value applied in multiple places in the
query. So as written you are only getting prompted once right? If you want to
be prompted twice then you need to make the text in the parameter markers a
little different like [enter start date] and [enter end date].
How should I enter the criteria if I want to select a date range. E.g
date from 1/1/07 to 14/1/07

Date literals in Access must use US format or a non-ambiguous format like ISO
yyyy-mm-dd. For example, 4/7/07 will always be interpretted as April 7th. If
you want it to mean July 4th, then you have to enter it as 7/4/07 or as
2007-07-04. You an also use a non-ambiguous format like July 4, 2007.
 
G

Guest

depending on what you really need. if you wanted to have it sorted on date
from, enter this on the criteria of your query: between [enter date start]
and [enter date end], which will give you data from jan 1, 2007 to jan 14,
2007. you can also do that on the field date to, but it will have a different
result.
 

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

Similar Threads

criteria for date range 10
parameter date question 3
query date question 6
Date search query 0
Date Range Prompt 5
group by query 3
How do I write a Criteria to search by month?? 5
Access Using Parameters and Criteria in Access 2003 0

Top