Visit Gigasoft's Web Site
ProEssentials v10 Help
Chapter 3: MS Access ActiveX Walk-Through v2024 / Office 365

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.

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.


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

 

msaccess 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.

msaccess chart ProEssentials tutorial


The project opens and shows a default blank table.

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 Text type field.

msaccess ProEssentials chart data table

 

Adding a New Blank Form...


Using the Create menu, Add a new Blank Form. Below shows 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 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.

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.

 

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

 

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 ProEssentials 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
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 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 ProEssentials ActiveX charting result...
ActiveX Chart inside MSACCESS