Microsoft Access Charting Tutorial (ActiveX VBA)

point 1
symbol 2
symbol
shape
shape
point
shape
symbol

ACCESS ACTIVEX CHART COMPONENT Walk Through in Visual Basic

ProEssentials ActiveX Charting components are used when creating stand-alone client-side EXEs or within containers that accept ActiveX components. This ActiveX Charting Walk-through includes instructions for Microsoft Access 2007-2017 and should apply to later and earlier versions of Access. For Excel Click here for Excel Charting ActiveX Walkthrough

AI-Powered Development

ProEssentials includes an AI Code Assistant system with pe_query.py that gives AI tools on-demand access to the complete API — with ground truth validation that prevents hallucinated property paths.

Works with Claude, Gemini, GitHub Copilot, Cursor, and ChatGPT.

See the demo...
Best WPF Chart to download, evaluate, and choose for your Financial Scientific Charting.
Best .NET Chart download for Scientific Charting, Engineering Charting.
Hello World - Walk Through - Tutorial

ProEssentials charting within MS Access allows improved scientific, engineering, and financial charting within your Access databases; such as improved 3D, improved multiple axes, and improved end-user customization and export.

Our AI Knowledge and AI-Resources will help write 100% non-hallucinogenic OCX based VBA code.

Note that ProEssentials v10 installs an extensive demo project that replicates our complete 116 examples within Access: fully replicating our WPF, Winforms, MFC demos. We guarantee you've never seen this level of high performance charting within an Access Database. See the demo installed at ProEssentials10/Access/PE10FullDemo

MS Access chart ProEssentials 116 examples

Installation...

When installing ProEssentials, the setup program installs the ProEssentials DLL and ActiveX interfaces into the system directory. The setup program also registers the ActiveXs with the operating system, which prepares MS Access, MS Excel, Visual Basic for inclusion of ProEssentials components. You can manually register an ActiveX with "REGSVR32.EXE" found in your system32 or syswow64 on 64 bit systems. You can also use this utility to manually un-register an ActiveX by using the "-u" command.

Note that 32 and 64 bit OCXs use the identical file name but are different files.

  • PEGRP64H.DLL — ProEssentials x64 64 bit DLL
  • PEGRP32H.DLL — ProEssentials x86 32 bit DLL
  • PEGOH.OCX — Graph Object
  • PESGOH.OCX — Scientific Graph Object
  • PE3DOH.OCX — 3D Scientific Graph Object
  • PEPSOH.OCX — Polar Object
  • PEPCOH.OCX — Pie Chart Object
New MS Access Project...

From the [New] menu, create a new [Blank Database].

MS Access chart ProEssentials tutorial

The project opens and shows a default blank table.

Click / select the Table1 and referring to the image below, add a few fields and data as shown.
Fields 1 and 2 are number type fields, and Field 3 is a Short Text type field.

MS Access ProEssentials chart data table
Adding a New Blank Form...

Using the [Create] menu, add a new [Blank Form]. Below shows the newly created blank form.

Click / select the Form1 tab, then...

  • 1 — click the design button bottom right or [Design] menu,
  • 2 — click the menu [Controls], and
  • 3 — select the [ActiveX Controls] menu item.
Adding chart ActiveX to MS Access

You see the Insert ActiveX Control dialog showing all ActiveX controls registered with the operating system.

This image shows ProEssentials v9 and v10 installed, which will only be the case if both the v9 and v10 setup programs have been installed.

Select the Pego v10 Control and select OK.

MS Access insert ActiveX control

The Pego ActiveX is placed on the form. You may increase its size as needed.

Note the design view image may not fully refresh while resizing; toggling the design view button off and on will cause the chart to re-draw to your new size.

Adding Form OnLoad event...

Select the [Design] menu, and then the [Property Sheet] menu item to show the property window.

Double check that the Name property is set to Pego1 to match the VBA code below.

Make sure 'Form' is shown as the Selection Type, click the Event tab, and click the [...]for the OnLoad event to open the Visual Basic editor and add the code below to the Form_Load event. Note that within the design view editor, clicking the solid grey area below the detail section will also select the Form and show Form related properties and events.

MS Access ProEssentials chart in design view
MS Access VBA Code...

Pego1.SubsetByPoint = False
Pego1.Subsets = 2
Pego1.Points = 10000#

Pego1.MainTitle = "Hello World"
Pego1.SubTitle = ""
Pego1.SubsetLabels(0) = "For .Net Framework"
Pego1.SubsetLabels(1) = "or MFC, ActiveX, VCL"
Pego1.YAxisLabel = "Simple Quality Rendering"
Pego1.SubsetColors(0) = Pego1.PEargb(60, 0, 180, 0)
Pego1.SubsetColors(1) = Pego1.PEargb(180, 0, 0, 130)
Pego1.BitmapGradientMode = True
Pego1.QuickStyle = PEQS_LIGHT_SHADOW
Pego1.DeskColor = Pego1.PEargb(255, 255, 255, 255)
Pego1.GraphPlusTable = PEGPT_BOTH
Pego1.DataPrecision = PEDP_NODECIMALS
Pego1.LabelBold = True
Pego1.PlottingMethod = GPM_BAR
Pego1.GradientBars = 8
Pego1.BarGlassEffect = True
Pego1.LegendLocation = PELL_LEFT
Pego1.DataShadows = PEDS_3D
Pego1.FontSize = PEFS_LARGE
Pego1.PrepareImages = True
Pego1.CacheBmp = True
Pego1.RenderEngine = PERE_DIRECT2D
Pego1.AntiAliasGraphics = True
Pego1.AntiAliasText = True
Pego1.AllowDataHotSpots = True
Pego1.PEactions = REINITIALIZE_RESETIMAGE

Dim db As Database
Dim MyRS As DAO.Recordset
Dim MySQL As String
MySQL = "select Field1, Field2, Field3 from Table1"
Set db = CurrentDb()
Set MyRS = db.OpenRecordset(MySQL)
Dim nCount As Integer
Do While (MyRS.EOF = False)
Pego1.YData(0, nCount) = MyRS("Field1")
Pego1.YData(1, nCount) = MyRS("Field2")
Pego1.PointLabels(nCount) = MyRS("Field3")
nCount = nCount + 1
MyRS.MoveNext
Loop
Pego1.Points = nCount
MyRS.Close
Set MyRS = Nothing

Pego1.PEactions = 0

This code both initializes the chart with settings and passes data.

This code is slightly unique to MS Access implementations when reading data from SQL tables where the amount of data is currently unknown. Note the code sets:

  • SubsetByPoint = False
  • Subsets = 2
  • Points = 10000

The SubsetByPoint = False setting configures the chart to efficiently allow the Points property to grow or shrink as needed as long as Subsets stays the same.

This code sets Points to a likely maximum, then at the end of the code section sets Points to the actual number of records read. In the process of reading records the Points property could be increased, though it is most efficient to reduce the number of times Points is changed.

Once you become familiar with MS Access code to load tables as needed, there are more advanced features to copy blocks of memory with a function called PEvset.

Knowing how to use VB code to read tables into your charts is the most robust skill to learn. Rarely will one SQL populate a highly configured real-world chart. Having the option of sending some SQL results to a Subset and others to our Annotation features will allow for full creativity with the ProEssentials product.

MS Access ProEssentials ActiveX Charting Result...
ActiveX chart inside MS Access


Thank you for researching. Please contact our engineers if you have a question.

Our Mission

Your success is our #1 goal by providing the easiest and most professional benefit to your organization and end-users.

We are Engineers

ProEssentials was born from professional Electrical Engineers needing their own charting components. Join our large list of top engineering companies using ProEssentials.

Thank You

Thank you for being a ProEssentials customer, and thank you for researching the ProEssentials charting engine.