mon said:
I wish to run a report between certain dates. How do I do
that in a report, do I need to base it on a query or can
the report be adapted to bring up pop ups ie date1 and
date2.
Lots of ways to do this. The quick and dirty way is to base
the report on a query that has a criteria with parameters
under the date field. E.g.
Between [Enter Start Date] And [Enter End Date]
When you run the report, Access will automatically pop up an
input box for each of the parameters.
A better way is to use a form with two text boxes and a
button. The user can then enter the dates in the text boxes
and clikck the button to run the report. With this approach
you have two ways to go. The easy out here is to change the
query criteria to:
Between Forms!theform.txtStart And Forms!theform.txtEnd
The button wizard will generate the click event procedure to
run the report.
The best way is to not use parameters in the query. Instead
you would modify the wizard generated code in the button's
click event procedure to use the OpenReport method's
WhereCondition argument:
Dim strDoc As String
Dim strWhere As String
strDoc = "nameofreport"
strWhere = "[datefield] Between " & _
Format(Me.txtStart, "\#m\/d\/yyyy\#") & " And " & _
Format(Me.txtEnd, "\#m\/d\/yyyy\#")
DoCmd.OpenReport strDoc ,acViewPreview, , strWhere