Print a report from combo box (1 Viewer)

beamer2010

New member
Local time
Today, 04:35
Joined
Sep 12, 2017
Messages
2
Greetings:

Newbie here. I have a lot of reports. What I would like to be able to do is create a combo box with the names of the reports so the user can click on the report they want to print. Once the report name is select the report will print. I know this is something very simple but I can't find what I need anywhere I have looked. Btw I am a novice.

Thank you in advance for any help you can give.
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:35
Joined
Sep 21, 2011
Messages
14,217
I would do it like so.

The combo has the report name and a more meaningful report description. These are stored in a table.
ReportID
ReportName
ReportDescription

You show the description in the combo.
A button on the form runs code that opens/prints the report in the click event.
Code:
DoCmd.OpenReport ReportName
HTH
 

beamer2010

New member
Local time
Today, 04:35
Joined
Sep 12, 2017
Messages
2
Thank you for getting back to me. I tried this but I am not sure how it would work, do I have to do this procedure for each different report name?

For example this is the combo box with the choices for report

Missed Appointment report
Event Related Report
Computer Issue Report

When the user clicks on the selected report it will print. I was thinking I would use AfterUpdate but I am not sure how to select the correct report in the procedure instructions. Should I do a DoCmd for each report name? I hope this makes sense.
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:35
Joined
Sep 21, 2011
Messages
14,217
I was thinking about this very thing this morning for a database of mine.
I know that I will have some basic reports that will need no parameters. I know I will have some at least that will likely require from and to dates as parameters.

I plan on doing the following when I have everything else working first.
Create a report table tblReport
This will have a field for
ReportID
ReportName
ReportDescription
ReportFormName

at least.

The menu entry will open frmReports that will show a list of the report descriptions in a combobox with a button to Open Report. This could be a listbox if you want to run more than one report at a time, but that for me would only be for basic reports that do not have parameters.

In the click event of the button on the form I will do the following.
For basic reports with no formname I will just OpenReport with the name of the report from the combo. For those with a formname I will OpenForm of the formname (hidden) from the combo with parameter of ReportName. That way the target form knows what report to run when the parameters are entered.

So my combo will hold ReportDescription, ReportName and ReportFormName
That way I plan on using a common form where I can for parameters such as dates.

I can build on that later.

As mentioned that is the plan. :)

HTH
 

Users who are viewing this thread

Top Bottom