I have a combo box on my form. Based on the user clicking the choice in the list, I want a report to run. I can not come up with the code to do this. If I go into the event procedure "on click" and write a docmd.open report, this report opens each time a different choice is made. How do I write it so that it opens a different report for each choice made? Thanks!
I'd suggest using a Combo Box (or listbox), cboLaunch, based on a
Query with two fields: the "internal" name of the report (following a
naming convention, such as rptMonthlySales) and a human readable
field, "Monthly Sales Report - enter a date in the textbox". Make the
first column the bound column, with a width of zero, so the user sees
the human-meaningful name.
In the Combo's AfterUpdate event put code like
Private Sub cboLaunch_AfterUpdate()
DoCmd.OpenReport Me!cboLaunch <optional parameters>
End Sub
For instance, you can set the parameters to open the report in Preview
mode or print it directly, etc. - see the online help for OpenReport
for details.