Results 1 to 3 of 3

Thread: Access Pivottable

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    22

    Access Pivottable

    Hi,
    I have built a pivot table using VBA, and some of the codes are listed below,

    With frm1.PivotTable.ActiveView
    .RowAxis.InsertFieldSet .FieldSets("Client name")
    .RowAxis.InsertFieldSet .FieldSets("Orders")
    (I have problem when a second rowaxis is inserted)

    .ColumnAxis.InsertFieldSet .FieldSets("Money")

    .DataAxis.InsertFieldSet .FieldSets("Price")

    .AddTotal "Total Money", .FieldSets("price").Fields("price"), plFunctionSum

    .DataAxis.InsertTotal .Totals("Total Money")

    End With
    Screen.ActiveDatasheet.PivotTable. _
    ActiveData.HideDetails
    (This is to show the summarised version)

    what i get is, The dataaxis field is summarised, but the FIRST RowAxis(Client Name) is in "expand" mode. i have to manually click on the "Collapse" button on the tool bar in order to see the overall summarized version.

    how to "Collapse" the "Client Name" fieldsets using VBA?
    thanks in aniticipation.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Access Pivottable

    Record a macro doing the action you desire. Then stop and check out the module code generated by Excel to give you an insight in how its done.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2005
    Posts
    22

    Re: Access Pivottable

    HI, thanks for the reply,
    i know there is a record macro in EXCEL.
    but i am doing it in Access. and there is no record macro.
    besides, the codes generated by excel for this action does not work for ACCESS.

    so may i know if any of you have the code for this action.
    thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width