this is a common requirement. a standard solution is to create a form (or
use an existing one if it suits your purpose), and add two unbound textbox
controls to the form, named txtStart and txtEnd. in each query's Design
view, add criteria to the date field, as
Between Forms!FormName!txtStart And Forms!FormName!txtEnd
make sure that the criteria above goes all on one line in the query grid,
regardless of possible line-wrap in this post. next, on the menu bar, click
Query | Parameters and add each parameter to a separate line, as
Forms!FormName!txtStart
Forms!FormName!txtEnd
and set the DataType for each to Date/Time.
note that your posted criteria dates
will not give you January's data (even when the syntax is correct); it will
return all records with a date between 1/2/2007 and the last day of
February. the "greater than" and "less than" operators *exclude* the
comparison values from the returned data set, while the Between...And...
comparison *includes* the comparison values in the returned data set.
btw, if you're always pulling a calendar month's data, you might consider
adding calculated fields to your queries instead, as
MyYear: Year(DateFieldName)
MyMonth: Month(DateFieldName)
then add an unbound textbox control to the form, with a DefaultValue of
Year(Date()) and named txtYear, and a combo box control that lists all the
months, named cboMonth, with a RowSourceType of Values, and RowSource of
1;January;2;February;3;March....;12;December
set the control's ColumnCount to 2 and the BoundColumn to 1 and the
ColumnWidths to 0"; 1
set criteria in the MyYear and MyMonth fields in the query, respectively, as
Forms!FormName!txtYear
Forms!FormName!cboMonth
this alternate setup allows you to choose only the month (and change the
year when you need to) in the form, before running your reports - rather
than typing specific dates in two fields, which has a greater potential for
user error.
hth