Date selection in report

  • Thread starter Thread starter Jimmy W
  • Start date Start date
J

Jimmy W

I have a report based on a query. I need to be able to be "asked" what date
to select the data for the report. What is the easiest way to do that?
 
In the criteria row put something like this --
CVDate([Enter date])
Or
Between CVDate([Enter start date]) And CVDate([Enter end date])
 
Jimmy W said:
I have a report based on a query. I need to be able to be "asked" what date
to select the data for the report. What is the easiest way to do that?


The quick and dirty way is to use a criteria like:
=[Enter Date]

A better way is to create a form with a text box for the
date and a button to open the report. In this case the
query criteria would be like:
Forms![the form name].[the text box name]

The best way is to use the form and remove the criteria from
the query. The button's code would then use the OpenReport
method's WhereCondition argument to filter the report. E.g.

stCriteria = "the date field name] = " & Format(Me.[the text
box name], "\#yyyy-m-d\#")
DoCmd.OpenReport "the report name", acviewPreview, _
WhereCondition:= stCriteria
 
Back
Top