Preview/Print List Box by Report Caption
Posted on 2000-02-20
I want to put a list box (on a Print Form) of all of the reports with a Preview and Print Command Button. Rather than have the report list show the actual report name, I want the list to show the report caption. The user can then select a report and click Preview or Print and it will do it.
I'd like to put this code in multiple databases that I've designed.
SPRUCE22: For some reason I am unable to add comments. I had to go back and edit the original question. Parcing the Report Names is an option I'm looking at but I'd like to get some more ideas.
Just a note:
I have have succeeded in doing this through using a reports table where I have the name and caption of each report in a table (t_report). I created a list box which is bound to the report name but displays the caption. The code on the preview:
Private Sub cmdPreview_Click()
Dim strReportName As String
strReportName = lstReports.Value
DoCmd.OpenReport strReportName, acViewPreview
The problem with doing it this way is I have to add each report and caption to the table as I build them. There has to be a way to capture each report and its caption in a record using code.
I also know how to do a query of report names:
SELECT MSysObjects.Name, MSysObjects.Type
But - The names are carefully named with prefixes - I would rather display the caption of each report.
SPRUCE22: Thanks for the help - I agree that opening the report to get data would be innefficient. Is there anyway to store a comment in the msysobjects table? I noticed that if I added a comment to the report properties, a "Long..." showed up in one of the table's records for that report. Any ideas?