Results 1 to 6 of 6
  1. #1
    Jmoore86 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2013
    Posts
    9

    Exporting Query in both Pivot Table and Datasheet view

    Morning all - hopefully this will be a nice easy one for you!

    I've got a query that can be viewed as a Pivot Table within Access - my users are now asking to be able to export this to an excel file (I can do this using a macro no problem) but they want to have the pivot table on one sheet and the datasheet view in another. Is this possible at all? I reckon i'll have to use some form of VBA wizzardry, but thought i'd check out here too!



    Kind Regards,
    Jon

  2. #2
    stmoong is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Location
    Singapore
    Posts
    108
    Well, it is possible using VBA.

    Typically, I would create an instance of the Excel application object, and then create the workbook and the worksheets required.

    One worksheet will be the data in tabular form.

    The other worksheet will be the Excel pivot table referencing to the data worksheet. Use the Excel macro recorder to help you with how to generate the Excel pivot table using code.

  3. #3
    Jmoore86 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2013
    Posts
    9
    Thanks for your fast response Stan!

    My issue is, I don't want to have to "hand-hold" my users too much and I want to automate this as much as humanly possible... i'd rather they pressed a magic button and a new excel file appeared on a shared drive. If I give them anything to do, they tend not to follow instructions!

    Thanks again,
    Jon

  4. #4
    stmoong is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Location
    Singapore
    Posts
    108
    What I described is the way it is done in VBA code with a click of the button.

    You will have to write the code to do so.

    The macro recorder part is to give you reference to the code to generate the pivot table.

  5. #5
    Jmoore86 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2013
    Posts
    9
    Oops - I seem to have skim-read your reply! Just had a closer look, thanks for that I'll start coding!

    Thanks again,

  6. #6
    stmoong is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2011
    Location
    Singapore
    Posts
    108
    You're welcome!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 03-25-2013, 02:01 PM
  2. Replies: 2
    Last Post: 03-25-2013, 09:10 AM
  3. Exporting Pivot table
    By bcurrey in forum Import/Export Data
    Replies: 1
    Last Post: 10-20-2011, 08:03 AM
  4. Query default to Pivot Table view
    By Theremin_Ohio in forum Access
    Replies: 1
    Last Post: 03-30-2011, 09:17 AM
  5. Exporting pivot table
    By nesbtech in forum Import/Export Data
    Replies: 1
    Last Post: 04-28-2008, 12:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums