Discussion Locked

Access 2000 Report Date

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Access 2000 Report Date
I'm trying to run a report on entries by month. I need to be prompted for a date range i.e. "between 1/01/01 and 1/31/01" when I go to run the report. I'm able to to get this info in the query, by entering the statement in criteria, but it should be run at the report level. Any suggestions?? This is Access 2000 running a report.

4 replies

by bob sellman

Why not create a form? That way you'll have an easy to use user interface that will run without the need to remember how to use it.

Just create a form with two fields, txtStartDate and txtEndDate, plus a button to print (or display) the report.The query that is the source for your report should have the following criteria for the date column:
Between txtStartDate and txtEndDate

Use the query builder to build the right syntax (with references to the form) for the criteria.

For best results, include code behind the print report button that will check to be sure that txtStartDate and txtEndDate are not blank and if either is blank will give the user a message and return the user to the form.

for example:
If IsNull(me.txtStartDate) or IsNull(me.txtEndDate) then
msgbox "Please enter the starting and ending dates",vbExclamation
Exit Sub
End If

If the report is always running for calendar months, you might get fancier and let the user select a starting and ending month and when the print/display button is clicked build the actual dates in code. Or, using the same concept, let the user specify the starting month and the number of months to print.

by djpinson

Thanks, that's exactly what I did prior to recieving your suggestion. It works great...

At least we know you're right on the money!

This discussion is closed to new replies.