Question

I have an Access 2010 report which currently displays all the records from a table. I want to add a date picker, which enables users to select a date on the report and display all records later than the selected date.

Is this possible in Access 2010 reports? If so how?

Was it helpful?

Solution

You have 2 options to do this:

1) Set a where clause in the SQL code for the report and have it be:

WHERE SomeColumnDate = EnterDate

from there when the user opens the report it will prompt them for the date.

2) This one is cleaner however more complicated, you need to create a form with a text box which is formatted to be a dateTime and then a button. In the report Set a WHERE clause again like this:

WHERE SomeColumnDate = Stuff

in the design view for the query go to the WHERE statement and change the condition to [FORMS]![FORMNAME]![TEXTBOXNAME] From there you will then need to go into VBA code for a button in the form and set it to do this code when clicked:

Dim strWhereClause As String
strWhereClause = "SomeColumnDate = " + Me.txtDate.Text
DoCmd.OpenReport "SOMEREPORTNAME",acReportView,,strWhereClase

this will make it once you click that button it will run the report with the date selected by the user.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top