How to display MS Access Reports in a web page?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jason Hamilton
    New Member
    • Jan 2011
    • 9

    How to display MS Access Reports in a web page?

    Greetings all,

    So first post here, but it looks like an active, helpful community, so here goes.

    I am working with a client who wants to make his current MS Access 2007 Reports available on demand in his web site. Currently, as I understand it, the managers of the company are being required to actually load MS Access and the active database to run the reports which exposes all of the data and linked tables to people who have no reason to modify them. So my client just wants them to be able to log into the admin section of the company website and request a report which he has already built in Access. I am trying to figure out how to get those reports to an ASP.NET application for the website to consume.

    I have already spent a day looking at the Microsoft.Offic e.Interop library, and I don't think that that will cut it because I can actually get the HTML for the Report directly out of the application. All I can find is an option to save it to the hard disk which is inelegant and could easily cause problems with filename changes when I try to then load the document from ASP.

    What I would like to see is a solution by which I can load the mdb or accdb file into the ASP application, access the Reports as a container and select the one I want by name, and then run it and collect the output in HTML to then simply echo to the webpage. Is there anything out there that can:

    Code:
    // Psuedo-code
    Dim AccessFile As MSAccessFileOperator
    Dim Reports As List(Of MSAccess.Reports)
    Dim htmlResult As String
    
    AccessFile = New MSAccessFileOperator("myDatabase.accdb")
    Reports = AccessFile.Reports
    htmlResult = Reports("MyReportName").toHTML
    I haven't found such a method yet, and I am okay with the idea that maybe it isn't possible to do it that easily, but, at the end of the day, I need the HTML result of the Report to exist in memory as a String. Any thoughts?

    Jason
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Well... you can automate exporting access reports to html format using the DoCmd.OutputTo command but it's not dynamic. You would have to reexport each time you wanted to update the information.

    If you want it dynamic, you could create a data access project instead. I think you would have to recreate the reports. And I think the user would have to install an Active-X component.

    Comment

    • Jason Hamilton
      New Member
      • Jan 2011
      • 9

      #3
      Right, DoCmd.OutputTo will write a file to the hard drive though, which I would have load from there again at some point. It also causes Access to actually open and, on my machine anyway, I have to click through a dialog box (in access) and choose a file name. My client wants more automation than that.

      With regard to the second option, I don't mind the ActiveX component, but if I have to 'recreate the report' then he can't build it in Access, right? The specific request was to allow him to do what he has always done and create the report in Access, but to just pass the results to a web page on request.

      Like I said, I'm not even sure if this is really possible without writing MS Access plugins and what not, but... is there another way?

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        You don't have to click through the prompts for DoCmd.OutputTo if you supply enough parameters.

        A data access page is created within Access.

        Comment

        • Jason Hamilton
          New Member
          • Jan 2011
          • 9

          #5
          Well, I am using a COM reference to 'Microsoft Access 12.0 Object Library' and don't seem to have a DoCmd.OutputTo. .. what I have (and have been using) is a RunCommand(Acce ss.AcCommand.ac CmdExportHTML) which works except that it doesn't accept any additional parameters. Am I using the wrong library?

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            What version of access are you using?

            Comment

            Working...