Printing a data report can be accomplished in one of two ways. The user can click the Print button that appears on the data report in Print Preview mode (using the Show method), or you can programmatically enable printing using the PrintReport method. If an error occurs during printing, trap it in the Error event.
For More Information See "Data Report Events."
When printing a report programmatically, you have two choices: to print by displaying the Print dialog box, or by printing without displaying the dialog box.
To display the Print dialog box
DataReport1.PrintReport True
The Print dialog box allows the user to select a printer, print to file, select a range of pages to print, and specify the number of copies to print.
Note Printers must be installed on the computer in order to present a choice of printers.
In some cases, you may wish to print the report without user intervention. The PrintReport method also gives you the option of selecting a range of pages to print, either all, or a specified range.
To print without displaying the dialog box
DataReport1.PrintReport False
Or, to specify a range of pages to print, use the code below:
DataReport1.PrintReport False, rptRangeFromTo, 1, 2