Applecore Pages on Microsoft Access

Allowing the user to print a report from a Combo Box selection

One way of allowing the user to be able to print/reprint reports easily is to populate a Combo Box with all of the names of the reports in the current Database. The main drawback with this is that if you are using a naming convention, 'rptCustomer' is not very user friendly, and you will also find it difficult to only show certain reports to be printed.

The way that I tend to do this is to create a small lookup table, tlkpReport, with the following fields:

Field NameField TypeField Notes
ReportNameTextPrimary Key for the Table - name of the Report as saved in the Database
ReportInterfaceNameTextA more user-friendly name for the Report
ReportDescriptionTextA description for the report

You can add other fields to this Table, for example a field to be used to filter if a report is to be printed. Next create a Form, and add a Combo Box, cboReport, to the Form. Set the RowSource of this control to the lookup table, tlkpReport. Change the width of the first column, containing ReportName, to 0, so that the user doesn't see the internally used name for the Report. As this column should be the Bound Column for the control, you can then use the Combo Box's AfterUpdate event to quickly print the report:

Private Sub cboReport_AfterUpdate()
    DoCmd.OpenReport Me!cboReport
End Sub

Top

 


HOME | NEW | TABLES | QUERIES | FORMS | REPORTS | GENERAL | API | DOWNLOADS | TUTORIAL | RESOURCES
E-MAIL
Copyright & Disclaimer

 

Last modified at 06/06/2006 15:00:53