Connect combobox to reports

samash1

Registered User.
Local time
Today, 13:45
Joined
Nov 3, 2008
Messages
14
Hi,

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?

Thanks,
Sam
 
First, some suppositions since I am not sure how your combo box or report naming methodology is set up .... :D

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

-dK
 
Sorry to be a newbie but how do i create a table of my reports?
Thanks ;)
 
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.

Check it out and post back.

http://downloads.btabdevelopment.com/Samples/listbox/SampleSelectReportFromForm.zip
 
Ive managed to get it working using your code,

Thanks very much!
Sam
 

Users who are viewing this thread

Back
Top Bottom