In my continuing push to improve what can be done in Access, I decided to see how I could create gauges in Access to show progress, statuses, percentages, … in a visual manner.
I won’t bore you with all the details, but the end result was to leverage the power that the WebBrowser control has to offer and use one of many JavaScript libraries.
In my demo file, I offer 2 ways to approach its usage:
-
- create a template index.html file with all the setting pre-established and simply automate pushing the value to display
- use a class to gain full control of the gauge in real-time
So the choice is yours!
Here are a few screenshots to show you a little of what is possible.
The database was tested on Access 2010 onward (I tested 2010, 2013, 2016 and 2019 and with both 32 and 64-bit versions). It will not run on earlier versions because of the WebBrowser control was updated at that point in time. That said, it could easily be ported to the earlier version if wanted as it is not tied to any features of the ‘newer’ WebBrowser control.
Limitations
The current limitation is the fact that the WebBrowser control cannot be used in continuous forms, nor reports. I’m hopeful that whenever the new WebBrowser control gets released that we will finally be able to get around that limitation. Fingers crossed.
One things that I have done though, is build out a form and then inserted that into the report to manage to get it to display visually in a report, but printing still omits the WebBrowser rendering. So if your report is only viewed on a screen, this can be an effective workaround.
Special Acknowledgement
A special thank you to Thomas Möller for his Better Access Chart class. Thanks to his work, I was able to use his class object as a template to create this one.
Setup & Usage
- Download the demo file below.
- Unzip the file contents to a folder of your choosing
- You may need to remove the Mark of the Web (MOTW)
- Open the database and enable its content (or setup a Trusted Location for its folder)
- You may wish to review/implement https://www.devhut.net/everything-you-never-wanted-to-know-about-the-access-webbrowser-control/#Local
- This demo illustrates both using local JS files as well as Internet based CDN JS files, as such you need an active/open internet connection for some of it to work, or else you will receive errors.
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
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 demo copy by using the link provided below:
Download “Access - Gauges” gauges.zip – Downloaded 7083 times – 115.71 KBVersion History
| Version | Date | Changes |
|---|---|---|
| V1.000 | 2022-05-30 | Initial Public Release |
| V1.001 | 2022-06-08 | Address what seems to be a timing issue on some versions with GaugeDraw Procedure causing a ‘Gauge’ is undefined error for some people |



Well-done! Thank you Dan for sharing this idea. More power to you!
Très intéressant comme approche, et utile pour les tableaux de bord, merci pour votre contribution !
You always present extremely interesting articles which in turn stimulate ideas! I was excited to try this one out but keep getting an error when opening the ‘with class’ form. I’ve installed both java script and the JDE with no success. The error is…
An error in the script on this page.
Line: 20
Char: 9
Error: ‘Gauge’ is undefined
Code: 0
Access: Microsoft® Access® 2016 MSO (Version 2205 Build 16.0.15225.20028) 32-bit
Any ideas?
There is nothing to install beyond the demo file itself.
I am unable to replicate any issue on my end.
You properly unzipped the content?
You’ve enabled the content or added it to a Trusted Location?
You followed the various information from my article, in particular: https://www.devhut.net/everything-you-never-wanted-to-know-about-the-access-webbrowser-control/#Local?
Same problem from my side, but with form “Gauge_No_Class”, it’s work
Very odd.
Try replacing the existing DrawGauge procedure with
Public Sub DrawGauge(Optional bOutputToFile As Boolean = False) Control.Object.Silent = True With Control.Object.Document .Open .Write getHtmlString .Close End With Control.Object.Refresh If bOutputToFile = True Then Call saveHtmlFile(getHtmlString) 'Simply for learning or Debugging, not needed in production! End SubNo more error with your update, but the gauge was blank
I’m afraid I don’t have an answer for you.
I managed to eventually replicate the error that was described on a VM and addressed it the update V1.001. the db worked fine on 4 different VMs I tested it on. Not sure what else I can do at this point.
Feel free to dissect, test, perhaps you will find the issue.
The problem on my end, without the code revision, was that my system was missing the proper registry value… per Daniel’s https://www.devhut.net/everything-you-never-wanted-to-know-about-the-access-webbrowser-control/#Local post I added a msaccess.exe 32-bit DWord key of 12001 to https://www.devhut.net/everything-you-never-wanted-to-know-about-the-access-webbrowser-control/#Local? restarted Access ran the demo db and it worked perfectly.
Thanks again Daniel for your so very interesting (and detailed) articles!
– Bob
Thank you Bob for confirming the fix that was required on your installation. I’m sure it will help others!
I found the problem, it’s because my Access is in French!
The variables generateGradient, limitMin, limitMax, write “vrai” in “getGauge()” function and I replaced the following lines and everything works perfectly:
strText = strText & ” generateGradient: ” & IIf(m_generateGradient = True, “true”, “false”) & “,” & vbCrLf
strText = strText & ” limitMin: ” & IIf(m_limitMin = True, “true”, “false”) & “,” & vbCrLf
strText = strText & ” limitMax: ” & IIf(m_limitMax = True, “true”, “false”) & “,” & vbCrLf
Merci beaucoup !
I have to admit, I never considered localization. Thank you for sharing! Something for me to examine closer in my next version.
can you please write more about using java script elements in access?
Hi Daniel, I hope you are well? I am a regular follower of your website and YouTube Channel and find your work extremely helpful and am using many of the solutions that you have published..
I adapted your solution for building Gauge Charts in MS Access and have been successfully using it for many months until recently when Office 365 latest update (16.0.18827.20060) got installed. After this update the Gauge Charts are no longer getting rendered on Forms. No error message appears. Form just shows an empty Browser Control. The gauge charts worked absolutely fine until Office 365 Version (16.0.18730.20168).
Would appreciate if you can shed some light on this as I have put in a lot of work on an application that I developed and it was working perfectly fine till now.
Thank you…
Tariq,
I’d love to help you, but I ditched MS365 a while back and am no longer in a position to do such testing/troubleshooting. MS365 has been a disaster of continual bugs and truly doesn’t offer any real advantage over older version (say Access 2003!). So, it just didn’t make sense to continue with it. Beyond which I had some subscription issues that even Microsoft was unable to fix (there’s that great support they promote)!!!
My only suggestion would be to rollback to a stable build and wait. Then again, that’s pretty much the MS365 motto, rollback!
I wish I could be more helpful.
Hi Daniel,
Thank you for your reply… I feel your pain regarding Office 365 as it has been very unstable with updates coming up. Every time an update is installed, something stops working in MS Access.
Anyways, I rolled back to an earlier update version and got my database to work properly.
Your example for developing gauge charts in Access has been extremely helpful and I have been able to develop a few apps for customers who wanted Analytics capability in Access. They love these solutions.
Really appreciate the good work from you.
Thank you for you kind words. I truly appreciate it.
how to Use this in Access reports
You should be able to do so using the Modern Web Browser control.