Visit Gigasoft's Web Site
 ProEssentials v9 Help
Chapter 3: MS Access 2013 ActiveX Walk-Through

The following information demonstrates how to create your first MSAccess ActiveX Charting implementation. It discusses installation, adding ProEssentials to a project, writing your first few lines of code, and shows the final results. 

This walkthrough uses 32 bit ActiveXs so this examples is for MS Access 2013 32 bit.


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.



ProEssentials Pro DLL
PEGOG.OCX Graph Object
PESGOG.OCX Scientific Graph Object
PE3DOG.OCX 3D Scientific Graph Object
PEPSOG.OCX Polar Object
PEPCOG.OCX Pie Chart Object



ProEssentials Standard DLL
PEGOSG.OCX Graph Object
PESGOSG.OCX Scientific Graph Object
PE3DOSG.OCX 3D Scientific Graph Object
PEPSOSG.OCX Polar Object
PEPCOSG.OCX Pie Chart Object

New MS Access Project...
From the New menu, create a new Blank Database.

msaccess activex tutorial

The project opens and shows a default blank table.

msaccess activex reading table code

Adding a New Blank Form...

Using the Create menu, Add a new Blank Form.

msaccess adding new form to hold activex.

Below shows newly created blank form.

msaccess form to hold activex

Add example data we will read with VB code...

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

Msaccess activex data to read.

Adding ActiveX Chart to MS Access 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 ActiveX Controls menu item.

Adding ActiveX to MS access

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

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


Select the Pego v9 Control and select OK.

msaccess 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 Property Sheet menu item to show the property window.


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.

msaccess chart in design view.


MS Access VBA code MS Access VB code to load a table...

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

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
Pego1.Points = nCount
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 and 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 chart to efficiently allow for 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. And 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.


The below code windows show the VBA editor with code as shown.


MS Access Code Window...



MS Access ActiveX charting result...
ActiveX Chart inside MSACCESS