Reference a string value as an ActiveReport object.
Posted on 2000-04-04
In my SQL Server 7.0 database I maintain a list of all the reports in our VB 6.0 application. This list is presented to the end-user inside a listview on the main screen. The user selects which report they would like to view and press a command button to display it. The code behind this command button references the SelectedItem of the listview which is the report's name and passes that to a subroutine which displays the report:
In my subroutine, what is being received as a parameter is the report's name in a string variable:
mdl_transReporting_PreviewReport(myReportName as String)
What I'm currently doing is using a Select Case to evaluate the report's name and display the appropriate report:
Dim rpt As Object
Dim fPreview As New frmPreviewReport 'Form which contains the ActiveReport Viewer
Select Case myReportName
Set rpt = New rptMemberCostSummary
Isn't there some way I can directly display the report without using the Case statement? If I change myReportName to an Object or to an ActiveReport object, I of course get a type mismatch when I make the call. I'm fighting with the syntax here to correctly reference the SelectedItem in my listview as an object instead of a string. Any ideas?