Command button on Report to Print the Report

kplatt

Registered User.
Local time
Today, 15:19
Joined
Aug 26, 2009
Messages
115
Hi, I just need to know the code or what i need to do to put a comman button on an actual report through which a click of that button will send it to the printer. I tried to make a macro to run from a hiddent button on a report, but there is no option for printing a macro. Therefore I guess I need the code. Could someone show me the code to accomplish this? Thanks

Lets assume the following below.

Report = [Report Name]
Query = [Repot Name]
Button =[Command Button1]
 
Access 2007
 
If the report is opened in Print Preview mode you will find a Print button on the ribbon. If it was opened in Report View mode, then you can print from the Office button.

I don't think you need a button. However, if you feel you still do then the button will only work in Report View mode and it would make sense if it was put in the Header section of the report. On that note, on the CLICK event of the button (which you will find under the Events tab of the button's property sheet), select Code Builder and put:
Code:
Me.Print

Or look into the DoCmd.PrintOut method.
 
OK, I will check it out. I am just thinking from a user interface standpoint it may be nice just to have a print button for user. No what i mean.
 
On a 2007 report you should be able to put a command button on a header (set the display property to On Screen only) and then you can use the

DoCmd.PrintOut

code to do it.

(untested)
 
Bob, that one worked, how do i get it to open the print option page (ie. where you can choose whqt printer to print from. Currently it goes directly to print at the default printer. Any ideas?
 
I wrote the below in the code and I get and error "Run Time Error 2046"


Private Sub Command110_Click()
DoCmd.RunCommand acCmdPrintSelection
End Sub



Any ideas why it is not working?
 
HI all

I have made some command buttons, (close, print, Go to main menu: switch board) in a report header (access 2010) and it working well in report view and layout view. However, it is not visible in print preview. Is there any way to make visible and operational in print preview as well?
 
HI all

I have made some command buttons, (close, print, Go to main menu: switch board) in a report header (access 2010) and it working well in report view and layout view. However, it is not visible in print preview. Is there any way to make visible and operational in print preview as well?


I would be interested in this as well. I actually want to put a print, close, and email button in the upper righthand side of the report in print preview
 

Users who are viewing this thread

Back
Top Bottom