Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Desired Report

Status
Not open for further replies.

xeb

Technical User
Nov 14, 2003
81
US
How do I put a button on a switchboard that will prompt the user for the date of the desired report and then have the report print?

I've been trying to get this to work for two weeks, but I haven't been able to. I've searched "help" over and over for the answer but I can't seem to find it and the only manuals I have don't seem to tell you how to do this.

Thanks
 
You can put 2 text boxes on the form for the user to put the start dates and end dates into. Then when they click the button:

DoCmd.OpenReport &quot;YourReportName&quot;, acViewPreview, , &quot;YourDateField >= #&quot; & Me.txtStartDate & &quot;# And YourDateField <= #&quot; & Me.txtEndDate & &quot;#&quot;

If you can't put the text boxes for the dates on the form, then you could create a seperate form that pops up soley for the purpose of gathering the dates.

Hope that helps

-Gary
 
Is that the only way to do it?

My table contains many records, all of which have dates. I need to allow my users to quickly print a report based on one date (and one record).

Is there any way that they can click on a &quot;Print Report&quot; button on a switchboard, be prompted for a date, and then have the report for that date be printed?

Thanks.
 
You can put the parameter prompt in the query by putting

[Date]

in the criteria section of the date field for your query. Then use the same method I described above behind the 'Print' button, use

DoCmd.OpenReport &quot;YourReportName&quot;

Now every time the user clicks the report button a parameter box will pop up and ask for the date. After they put it in the report will run for that date only.

-Gary
 
I would always use a text box for quick input and validation of report criteria similar to glalsop's initial suggestion. Parameter don't provide any integrity checking and don't allow defaults.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top