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

Input Box Querying

Status
Not open for further replies.

Clegg25

MIS
Jul 27, 2003
24
US
I have access 2000. I had once created a form or query where a window would pop up and ask me for a date range. I would put in a date range, and the query would show only those records within that date range.
(the table has a Date field, and a Name field.)
Is there an easy way to do this? I forgot how i had done it in the past
 
Where [yourTable]![yourDateField] Between [forms]![yourForm]![BeginDate] And [forms]![yourForm]![EndDate]

Have this as your Where claus and youwill pull the records that fall within the date range.

You would need to have 2 calendar controls (or something to enter the date values into 2 separate fields), on your form.

Good Luck
 
I must be an idiot. I still cannot figure this out. Im sorry, but my access level is newbie.
I hate to ask this, but can you describe it in a little more laymen terms?
thanks,
 
You need some parameters.The way lynchg described it uses fields on your form to contain the upper & lower values for the date. You could as an alternative use 'imaginary' fields which means Access will prompt you when the query runs. lynchg's form method is more robust as you can verify that they have entered a valid date before opening the query.

SELECT MyName, MyDate FROM MyTable WHERE MyDate BETWEEN [Enter Start Date] AND [Enter End Date]

This will prompt you to 'Enter Start Date' and 'Enter End Date' assuming that the table 'MyTable' contains fields 'MyName' and 'MyDate'.
 
er ... the SQL statement that I wrote in my last reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top