officialvova.blogg.se

Printer selection
Printer selection





  1. Printer selection how to#
  2. Printer selection code#

If you need to know whether the report opened, check the return value of the function. OpenTheReport() traps and discards this annoying error message that can come from the report's NoData event, an impatient user, or some other problem. To display the description on the report, just add a text box with Control Source of: =.įifthly, it avoids the need to trap Error 2501 in every procedure where you open a report. It is passed to the report through its OpenArgs. You can therefore enter a description string.

printer selection

Without an explanation of the filter, the printed report is meaningless, and printing the filter itself on the report may be too cryptic. Instead, it provides a simple way to pass a description of the filter to display on the report. Thirdly, it avoids the problem where the report is not filtered correctly if it is already open.įourthly, it does away with the FilterName argument that is rarely used, confusing, and inconsistent. Secondly, this function defaults to preview instead of printing directly. (If you use the old OpenReport to print directly (no preview), it will not use the desired printer.) It is similar to the OpenReport method built into Access, but has several enhancements.įirstly, it looks to see if you have specified a printer to use for the report, and assigns it before opening the report. OpenTheReport() is the only function you need to learn.

Printer selection code#

In Access 2002, you must also include a reference to the Microsoft DAO 3.6 Library, by choosing References on the Tools menu from a code window. If you will use this with most of your reports, you may wish to set up a default report. To prepare your report to use this utility, open it in design view, and set these properties of the Report: The other form ( frmSwitchboardExample) and the reports are included purely for demonstration purposes. On the Forms tab of the dialog, click frmSetPrinter.In the Import Objects dialog, click the Options button, and check the box Menus and Toolbars.In previous versions, choose File | Get External | Import.Ĭhoose PrinterMgt.mdb as the file to import from. In Access 2007 and later, click the Access icon in the Import group of the External Data ribbon.To import the components of this utility into your database: To avoid this, program a delay between printing the reports, and include DoEvents. If you open several reports directly to print at once, the timing of the assignment of the Printer object may not operate correctly. Opening reports with the New keyword (for multiple instances) is not supported. Docmd.OpenReport works if the report is previewed, but not if it is opened straight to print. To use the correct printer, you must use the supplied function, OpenTheReport(). That can be done by opening the report in design view, and manipulating PrtMip. The utility does not let the user choose paper sizes. Albert Kallal has one for earlier versions: Access 97 or Access 2000. The utility works only with Access 2002 and later. The utility remembers the choice, and uses that printer for that report in future. To assign a printer, all the user has to do is preview the report, and click the custom Set Printer toolbar button.

printer selection

The function checks to see if the user has assigned a particular printer for the report, and assigns the Printer before the report opens. The utility has a function named OpenTheReport() to use instead of DoCmd.OpenReport. You can also view the code from this utility.

Printer selection how to#

The utility also illustrates how to manipulate the Printer object and the Printers collection introduced in Access 2002.Ĭlick to download the utility (30KB, Access 2002/3 mdb format, zipped). The utility works with MDE files and runtime versions also. Whenever they open the report, it is sent to that printer. This utility lets the end user assign one of their printers to each report. You can design a report to use one of your printers by choosing Page Setup from the Page Setup ribbon (Access 2010), the Report Tools ribbon (Access 2007), or the File menu (previous versions.) But that approach is useless if others use your report: you do not know what printers they will have installed. Printer Selection Utility Microsoft Access: Applications and Utilities







Printer selection