none
Additional Headers in Report to export to excel

    Question

  • This might sound complicated.

    I'm currently working on a report for a client that exports a table between certian dates. The query works without a problem. The report I would like to have two additional fields on top of it, one of them static and the other one can be dynamic, but that isn't so nessisary.

    I've brought the report together but the problem I have is after exporting it to excel, the two extra fields I just mentioned are absent. They're in the report, does access only allow for databound fields to be spat out this way? If so, I can just make a fake query to put into this as well that contains static info.

    Friday, July 15, 2011 5:00 PM

Answers

  • Yes, it just outputs the data.  Also, just so you get on the right terminology, you do not have two additional fields.  You have two controls.  Tables and Queries have Fields.  Forms and Reports have Controls which can be bound to fields or unbound.

    So, you could use Excel Automation code to export the data that is being used for the report and then using that you can also add the extra information.  What code (or macro actions) are you currently using for the export?


    Bob Larson, Access MVP 2008-2010, 2011
    • Marked as answer by Zero Serenity Friday, July 15, 2011 8:46 PM
    Friday, July 15, 2011 5:07 PM

All replies

  • Yes, it just outputs the data.  Also, just so you get on the right terminology, you do not have two additional fields.  You have two controls.  Tables and Queries have Fields.  Forms and Reports have Controls which can be bound to fields or unbound.

    So, you could use Excel Automation code to export the data that is being used for the report and then using that you can also add the extra information.  What code (or macro actions) are you currently using for the export?


    Bob Larson, Access MVP 2008-2010, 2011
    • Marked as answer by Zero Serenity Friday, July 15, 2011 8:46 PM
    Friday, July 15, 2011 5:07 PM
  • None of those. I'm sticking to design mostly for this one so I have the buttons that I use to export.


    One more thing. Is there a way to make a query that just returns the where data that's put into it?
    Friday, July 15, 2011 5:16 PM
  • Update: I've gotten quite close through the use of an empty table and a subreport with it. The only problem I have now is stacking them. When I export the top header section is to the right of all the data. I'd like to have it either on top or at least be the first column instead. Any ideas?
    Friday, July 15, 2011 6:58 PM
  • It isn't working the way I want it to. I'll say that there isn't an answer before using VBA. Thanks anyway.
    Friday, July 15, 2011 8:46 PM