Date selection in report

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?
 
K

KARL DEWEY

In the criteria row put something like this --
CVDate([Enter date])
Or
Between CVDate([Enter start date]) And CVDate([Enter end date])
 
M

Marshall Barton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top