Load Reports by Name?

Posted by: imnlfn on 4 August 2017, 3:23 pm EST

  • Posted 4 August 2017, 3:23 pm EST

    I am maintaining a legacy application in VB6 that uses ActiveReports 2.0 Professional.

    We would like to be able to run a customized version of some of our reports for each of our clients. The most streamlined way of doing this would be for us to create report names that varied by client code and load those reports dynamically by name.

    I realize this would essentially be using reflection, which is not at all well implemented in VB6, but on the off chance that I missed something in the Active Reports documentation, I thought I would ask anyway.

    Assuming my impression is correct and this isn't really possible using the method I described, does anyone have a suggestion to make the process easier than altering each report substantially on the fly or having a separate Case statement for each client?


  • Replied 4 August 2017, 3:23 pm EST


    Could you please elaborate a bit more as what you refer to by customized version of reports for each client?

    Will it just be a different name?
    Or you will show different data for each client but the report design will remain same for each of them?

    If you wish to show different data for each customer, then a suggestion would be to create parameterized reports wherein the data would be fetched on the basis of the passed parameter by the client.

    In case you wish to change the design, then you may access the report and on the basis of the logged-in client you can change the report's design at runtime.

    Let me know in case I misunderstood your query and please state your issue once again with.

  • Replied 4 August 2017, 3:23 pm EST

    It's the latter, I would like to change the design of the report for each client.

    The changes are too great, though, to make it practical to change the design on the fly for each client.

    It was a long shot, but I was hoping there was something similar to a Forms collection that would allow me to access a report programatically, rather than have to name each one explicitly in the code.

  • Replied 4 August 2017, 3:23 pm EST


    You are correct that with .NET this is possible using reflection but unfortunately the same approach won't work with VB6. You will probably need to create separate reports for each client and load them as and when requested. In the switch statement, for each case you will need to create an object of the report associated to that user and show it in the viewer.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels