How to write a macro to open a report that relies on a query?

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

    #1

    How to write a macro to open a report that relies on a query?

    Hey all,

    Okay, so here's what's going on. I have a customer who wants me to push the reports generated by MS Access to his corporate website on demand. I have most of this problem solved (by using the Microsoft.Offic e.Interop.Acces s library from inside a WCF Server and connecting to the server in an ASPX web application). There is one last piece that I can't figure out and I think I can solve it all from inside MS Access with a (small?) tweak to the customers mdb file.
    What he has done is created a report which gets its data from the results of a query. The query requires the user to select a date/time range, grabs all of the records from the multiple tables in that range and displays them in a report. Since the MS Interop library allows me to run queries, open reports, open forms or tables and the like, but doesn't allow me to actually interact with any of them, I can't just open the report, pass the date/time range selection and then OutputToHTML. Again, this is because I can't pass the date/time range from the Interop library call.
    So my solution was to create a series of macros in the mdb file. For each report, there would be an 'Echo_Today_[reportname]' macro, an 'Echo_Yesterday _[reportname]' macro, etc. and the user would simply be restricted to choosing predetermined date ranges. So what I need is to write a VBA Macro that will open the report, supply the associated query with a date range and then output the HTML. I can do all of that except run the query.
    How do I write a macro that will let me supply a variable parameter to a query?

    TIA,
    Jason

    [[edit]]
    take a look at a better way to ask the question.
    Last edited by Jason Hamilton; Feb 2 '11, 08:17 PM. Reason: Found a more concise way to ask the question.
Working...