Command button on Report to Print the Report

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.

Lets assume the following below.

Report = [Report Name]
Query = [Repot Name]
Button =[Command Button

Sponsored Links:

Related Topics

Print a report without displaying print preview
I have several forms which have a print button (created with the command button wizard, report operations, print report, then relevant report is chosen to print). This works great, and prints the relevant report for the the associated record, however when you click the print button it also displays the print preview and doesn't close it again. This means that until the preview is closed the same thing keeps printing when the button is clicked.

but I've managed to looked in the button's properties, and it's created a macro - runcommand, print. When you click on that line there is a description called view from which you can choose either print, design, preview, layout etc, I've tried changing it to all of the other options, but the only one that makes the report work is preview.


Print button problems
I have made a report ("Timings Report") which opens on the click of a button from a separate form ("Progress Form"). The report has a print button which opens the print dialog box for the user.

The problem I am having is concerning the button on my form - when I click it, instead of opening the report, it just automatically prints the report. The code for click command on both is below.
....

Another problem I have been having with the code (which isn't as major) is on printing, the print command button still prints. I have tried using the cmdPrint.Visible = False statement butI just get an error: "You can't hide a control that has the focus."


Button that had open report command only try and print on click?
I have a button on a form that I would like to have open a report. In the button's on click event I have coded this:

Private Sub instrument_index_button_Click()
DoCmd.OpenReport ("rInstrumentIndex")
End Sub

When I click the button it tries to print the report. Is there more to the command that I need to get this to work the way I want?


Report Printing Problem
I have an Access 2010 Database. I use a form to set parameters for a number of reports including a combo box to select which report to print. When the user clicks on the command button the report is generated in Print Preview and when satisfied the user clicks on the print button. The issue is that the report is not printed the form is printed?


Printing report from command button in color
I have the following code for a command button to print the designated report. The print job goes directly to the printer and prints in black ink only. How can I have the print job automatically print in color, or have the print promt come up for the user to choose black ink or color.

Private Sub Command54_Click


Generating next report
I am trying to make (print) an invoice based on a work order. I have looked through some examples but am missing something. I have put a command button in to print a report but I don't know how to load the report with the new record. I am assuming I do this using a query some how?


Need to print a Report
I made a form where I added to command buttons. The user is supposed to be able to click the command button and have the report Print. I was right-clicking on the command button and I was trying to write the code, but I am very new at this, so I think I messed it up worse. I was trying to also build a Macros and use the PrintOut command, but I could not get it done.

If someone can help me to either build a macros or write the code, I would like to first use the OpenReport command and then the PrintOut command. I just do not know how


Print different Reports at once
I have three different reports that I like to print at once by a command button on my form. The reason is that the report only holds 22 inches of information on it so I had to split it up into three different reports.

The first report is the one that prints by the ID and the rest just has information that relates to the first report I.e., Definitions etc.

I have created a macro but I can't get it to run properly.
This is how I got the macro setup:
OpenReport | first report by ID
OpenReport | Second report IRB Section
OpenReport | Third report definitions
Runcommand Print Preview


Open a Report by Command button
I currently have the following code in an event procedure that by clicking a command button the following happens. the code below opens up a report in Print preview and not the regular report view. How do I change the code so that by clicking the command button, the regular report view (green folder) is opened.

Private Sub Command7_Click()
DoCmd.OpenReport "TRI Chemical Purchases", acViewPreview


Print vs. Print Preview
I am adding a report to an Access 2007 Db that will end up being a Runtime version. On the switchboard (actually a form I'm using as my switchboard) I have a button to print this report.

Here's the problem. When I click the button to print the report, it opens the report in "Print Preview", but I'm seeing a blank report and a Print window. if I click on "Print", the report prints AND I get to see the Print Preview.

However, if I click on "Cancel", I am allowed to see the Print Preview, but have then lost theability to Print.

What I was hoping was that the Print Preview would open so my users might decide if they wish to print or cancel.


MSAccess Lose Focus on Print Preview
I have a form that has field and button to query a report.
User fill in the field and hit the button to view the report.

I use this command to open the report.
DoCmd.OpenReport sReportType, acViewReport, , sQuery, acWindowNormal, sQuery

On the report itself it has a print preview button, which I use a macro to code it.
Action : OpenReport
Report Name : Import Rpt
View : Print Preview
Filter Name & Where Condition : Left Empty
Window Mode : Normal

It could trigger to open the print preview view of the report. But MSAccess has lost the focus. So user must go somewhere else then go back to MSAccess to have control to the mouse.

I am using MSAccess 2007 SP 2 with Windows 7 OS


Command Button: Print for Grouped Reports
I know how to program a command button to print a single record:
DoCmd.OpenReport "[Report]", acPreview, , "[ID] = " & Me.[ID]
DoCmd.PrintOut
DoCmd.Close acReport, "[Report]"

I also have created a command button to print one person's multiple records:
DoCmd.OpenReport "[Report]", acPreview, , "[name] = " & Me.[txtname]
DoCmd.PrintOut
DoCmd.Close acReport, "[Report]"

.I'm stating what I already know, to clarify what I've already tried.
But I have a mileage log report based off one form and one table that is grouped to print by months, I need to know how to create code for a command button, that allow's you to pick the month, and print only that current/monthly record. The idea of the 'name' above won't work because they don't have something in common, except the month in the date textbox, but there's also the day and year in the same textbox. and they will not be happy if they have to have a seperate textbox for month, day, and year


Prevent a control from being printed
I have an Access 2007 report that has a button that says print this report, that run a macro to do just that. However, when the report prints, I would not like that button to print as part of the report. Is there a way to accomplish this?


Use report parameter to update table upon printing
I have a form in which I have a Print Report button. The button currently runs a a report I created. I have a parameter which prompts for an input for the SQL query within the report.

Is it possible, upon report closure or after print completion, to have this parameter and the current date (the report is printed on) be saved in the appropriate fields within the same record set the report query just printed


Setting a reports record source in VB
I've got a report where I want to set the record source to one of six queries using code when I click a command button, and then fire up its print preview. The problem is the code keeps throwing up an error message saying I cannot change the record source once I've loaded the report for printing, but if I try to define the record source prior to loading the report another error is generated telling me to load the report first.

Is it possible to set the record source for a report then fire up the print preview all using VB and from a single kick of a command button


Print Preview Command Button Locks Access
I have a Print Preview command button on a Report. When I press the button the report is taken into Print Preview mode, but Access then locks up.

I cannot perform any actions in Access unless I first click on another active program in the task bar at the bottom of Windows and then click back to Access. Then everything works fine.

I've tried this on several forms with the same problem. I even closed and restarted Access, but still the same problem


Help with access 2010 Navigation form print button
I have been assigned a task at work that involves recording, tracking and managing assets and the calibration intervals. I am very new to access and basically self taught with the help of some great forums.

I have encountered an issue with one of my navigation forms and would like some insight. I have created a navigation form that shows a list of reports I have created. In the navigation report I would like to have a print button that only prints the selected report.

It seems that access 2010 allows you to generate a print button, but wants you to designate it to one report.

Is there a way that I can make a print button print only the report, and only the report that is selected on the navigation form.


Printing problem
I have a program that prints out a report using the print command that I have in a macro (it works from a form). It has worked fine for a couple of years.except with one person. When hehits the print button, it prints the report but then the program blows up and attempts to make a backup.

Even weirder is that I changed the program to use print preview and allow him to print the document from there. It works just fine. Why is the print command giving that one person a problem.


Logic statement to select report
To simplify my reports, I am planning on making three reports that will all differ to print data from the same form. This is due to some reports needing features that others will not. Whenthe user clicks print on the form, I only want one of the reports to print though.

The report would be selected based on the current record set pulled up in the form. I.E. if that record set contains a number 5 then print report 1, a number 7 then print report 2, or a number 9 then print report 3.

I have the form and report printing fine right now when I reference the report directly in the macro and switch it out for each report.

I tried setting up a Macro with Open, Print, Close commands for each report with conditional statements defining which form to select. It seemed it only looks at the first record in thedata set it is printing and makes the call then moved to the next command which dosent work.


Print Report Macro
My problem isn't very big just that I cannot solve it.

I have produced a report that can be opened by a macro on my form. On my report I have command buttons including a 'Print Report' button. Is there any code or a way I can stop the buttons from being printed on my page. Could it be to do with where I have the buttons. They are in the Page Footer area and I have tried Report Footer with no luck