Query Filter

  • Thread starter Thread starter ckerns
  • Start date Start date
Assuming that these 2 boxes are not bound to fields in the same query, and
that they both contain valid dates, you could just use this in the Criteria
row of your query under the Date/Time field:
Between [Forms].[Form1].[txtStartDate] And [Forms].[Form1].[txtEndDate]
where Form1 is the name of the form and the 2 text boxes are named
txtStartDate and txtEndDate.

To ensure that the dates are correctly interpreted:
1. Set the Format property of the unbound text boxes to "Short Date" or
similar, and

2. Declare the parameters, by choosing Parameters on the Query menu in query
design, and entering these 2 rows into the dialog:
[Forms].[Form1].[txtStartDate] Date/Time
[Forms].[Form1].[txtEndDate] Date/Time

If you want to build a Filter string for a form Report, and handle the case
where one or both text boxes might not have a value, see:
Limiting a Report to a Date Range
at:
http://allenbrowne.com/casu-08.html
 
Back
Top