Users can print out all records or a specific record or range of records. The user can use either VB code or Macro to print as I will show the how to below. There are two most common methods to print. Print Preview Report: The user will see how the report looks like before printing.
|Published (Last):||18 January 2009|
|PDF File Size:||18.59 Mb|
|ePub File Size:||17.43 Mb|
|Price:||Free* [*Free Regsitration Required]|
That just sounds ugly. On the other hand, it fits in with the normal Access paradigm! It absolutely does NOT fit any Access paradigm. It was not until Access that a proper printer object was introduced that allowed full control of printing.
That was because of legacy issues with VB and the Windows printing system. I know it is UGLY to have to open it in design mode but hey, if it works what can you say? OpenReport method. This makes it possible to open a report in print preview mode and have it be hidden. PrintOut to print a page range. The way I would implement this is with a public function and a dialog form.
Echo False DoCmd. PrintOut acPages,! Close acForm, "dlgPrinter" DoCmd. Close acReport, strReport Application. Echo True End Function The dialog form would look something like this: source: dfenton. OpenArgs Me. DeviceName Next varPrinter Me! Printer Me! DeviceName Me! Orientation End With Me! Tag property for the report name, and then do everything based on that, including making changes to report properties on the fly, which is possible because the report is open in preview mode, but not visible.
Pages End With The reason I change the page range numbers is because changing the orientation will most likely change the number of pages. Unlike in the OnOpen event, changes to a the format properties of a report open invisibly in Print Preview mode happen immediately. Visible property to False, which allows the calling code to continue. Tag property to "Cancel" and check the. Tag property when the code continues in the calling context see above.
One thing that would need to be changed in production code is making sure there was an error handler in the PrintReport function so that if something went wrong, Application. Echo can be turned back on otherwise, the user might be stuck with a blank screen and unable to work. The alternative would be to just let the report appear onscreen when the DoCmd. SelectObject method is invoked. For more information on this, you should investigate the. Printers collection and Application. Printer object and the ones associated with a particular report.
I also found a little tutorial on the Office site that clarified a few things.
DoCmd.OpenReport method (Access)
Click in reprt box next to On Click and select Event Procedure. There are no open issues. You can print datasheets, reports, forms, data access pages, and modules. Well basically, from a switchboard, i want to print a report without having to open it, go to filed and then click print.
Subscribe to RSS