Access Pivot Tables and Pivot Charts

Surprised to see someone talking about using Pivot Tables and Pivot Charts, aren’t you!

For those that aren’t already aware, Microsoft did away with these, too much protest I must say, with the release of Access 2013.

To Much Protest ....
When I mention “to mush protest” I was referring to the deluge (by Access standards) on Uservoice asking to have the feature reinstated.  There were numerous suggestions all asking for the same thing and 2 of which were the 2nd and 5th most supported requests, yet both were ‘No Current Plan’.  You can view all the details for yourself by perusing:

Over the years I’ve seen numerous questions relating to how we could get them back…. So that got me thinking and I came up with a couple possible solutions:

  • use the WebBrowser control to replicate the features
  • automate Excel and create them there instead

In this article, I will concentrate on the latter and perhaps in the future (if there is some interest) I will explore the automation of Excel option.

Pivot Tables and Charts in a WebBrowser Control

I’ve said it a couple times now, but the WebBrowser control is seriously undervalued by most developers as it can open the doors to so many extra feature allowing us to extend Microsoft Access’ native capabilities.

Before going any further, if you haven’t already, you might want to review:

which covers all the basics of automating the WebBrowser control.

So I set off and did a quick online search and quickly came across a remarkable JavaScript library that appeared to offer the functionality I was after:

The Github Project Page:

The Example Page:

 

Armed with this I set off to integrate the samples into an Access form utilizing a WebBrowser control.

Below are a couple examples of what I was able to achieve with very little effort.

Access - Pivot Table 01

Access - Pivot Table 02

Access - Pivot Chart - Horizontal Bar Chart

Access - Pivot Chart - Area Chart

So as you can see, we can give back Access some of the capabilities removed by Microsoft with not that much effort at the end of the day.

This is all contained within a single form, or 2. No need for APIs, so no bitness issues, or ActiveX considerations.

Disclaimer/Notes:

If you do not have Microsoft Access, simply download and install the freely available runtime version (this permits running MS Access databases, but not modifying their design):

Microsoft Access 2010 Runtime
Microsoft Access 2013 Runtime
Microsoft Access 2016 Runtime
Microsoft 365 Access Runtime

All code samples, download samples, links, ... on this site are provided 'AS IS'.

In no event will Devhut.net or CARDA Consultants Inc. be liable to the client/end-user or any third party for any damages, including any lost profits, lost savings or other incidental, consequential or special damages arising out of the operation of or inability to operate the software which CARDA Consultants Inc. has provided, even if CARDA Consultants Inc. has been advised of the possibility of such damages.

Download a Demo Database

Feel free to download a 100% unlocked copy by using the link provided below. Furthermore, this download includes examples using both the ‘old’ Web Browser control and a second one using the Modern Web Browser control.

Download “Access - Pivot Tables and Pivot Charts” MSAccess_PivotTablesCharts.zip – Downloaded 7020 times – 1.99 MB
Requirement(s)
Note that for this JavaScript library to work, for the ‘old’ Web Browser control example, you must first implement the Feature Browser Emulation hack for IE11, or higher.  You can learn more about it at: https://www.devhut.net/everything-you-never-wanted-to-know-about-the-access-webbrowser-control/#Emulation

Other Resources on the Subject

 

Page History

Date Summary of Changes
2022-09-27 Initial Release
2024-01-25 Updated sample download to include examples using the ‘old’ Web Browser control, as well as the Modern Web Browser control

3 responses on “Access Pivot Tables and Pivot Charts

  1. Ward Bowman

    Hi Daniel

    Great way to get around the problem of pivot tables and graphs. The java script you found seems to have more functions that the old Access Pivot table and Graphs.

    I tried running your database and on all 3 forms and I get the dreaded script errors.

    I will spare you the minor details of testing and debugging, simply put by exporting the script to a html file I was able to run them in any browser. I even created a form, added a WebBrowser control pathed to the file and that worked.

    I tried your test form “WebBrowser_VersionCheck” and it reported Version 7 for IE, so I checked that you had emulation lines in the script, you did, but Access seemed to ignore them.

    After some research I found this article

    https://weblog.west-wind.com/posts/2011/may/21/web-browser-control-specifying-the-ie-version

    I added a DWORD with a vlue of 11000 for MSACCESS.exe to HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION

    The database forms worked as shown in your video, and your test form reported IE11.

    Thanks
    Ward Bowman
    Archimedes Consulting Ltd.
    Engineering and Project Management.