I have a list of reports and i have a drop down list on a form. I need to connect each of the options in my dropdown list to a different report. Can anyone help?
First, some suppositions since I am not sure how your combo box or report naming methodology is set up ....
Suppose that you stored the reports in a table called tblReports. Also suppose that the common name of the reports was not the same as the actual report name (e.g., Customer List -> rpt001_Customers).
Now, suppose you set up the unbound combo-box (cboReportNam) set up so the Row Source queried tblReports and the first field in the QBE was CommonName, and the second field was ReportName. Note that the columns of the combo box are formatted like: 2";0" (hiding the second column).
Last suppose you had a button that executed the report action. In the on Click event of button you could use something like the following.
Code:
Dim sReportName As String
sReportName = Me.cboReportName.Column(1)
DoCmd.OpenReport sReportName, acPreview
See if this sample helps at all (although it might create more questions). This will allow you to have a list box with all of your reports that have a certain prefix as the name and therefore you don't need to maintain a table of reports. Just name the report with a certain prefix. Then double-clicking on the listbox will open the applicable report.
If you want, you can modify to use a combo box instead.