If you like my graph example, please donate
thank you

Connect to me - let's build your application together

Access MVP Home

Access Basics Video Tutorials Learn VBA ListFiles Database Random Picker Error Handling Reference Database Whistles & Bells Help Examples
Crystal's Analyzer Code Documenter Access Graphs

Graphs in Access
Do you want to know how to manipulate graphs and charts using VBA and Access? ~~ CLICK the ARROW in the middle of the image to watch the 20-minute video ... shows how to drive charts from a menu form that collects criteria, how to change data for the graph, set the chart title, x-axis title, and modify scales and formats.

watch THIS video to lean How To Make a Graph in Access:

Quick Jump To Sections

Screen Shots for Crystal's Graph Example

Graph Example Menu

Graph Menu Example

Example Graph

Example Graph

goto Top

DOWNLOAD Graph Example

Numbers looks so much better on graphs! This is example shows how to set graph properties using Access and VBA based on specified criteria such as dates and key fields. The menu is called f_Graph_MENU. The form that shows the graph is f_Graph. f_PopupCalendar is a for collecting dates (tiggered by double-clicking a date control). The sample tables are called t_GraphData and t_GraphTopics. The code creates the qGraph query used by the graph. This was developed in 2010 using Microsoft Graph 14.0 Object Library, which does need to be referenced due to late binding. If graph has no data, an error is generated. This could be trapped. SetControl_RowSource is used on the After Update of the topic to limit other combos. This is done by putting the SQL without criteria in the Tag property of each respective combo.

There is a form called f_Graph that has the Microsoft Graph control and a couple other controls that get modified. The menu form is called f_Graph_Menu. The button that opens the graph is captioned "Chart". The time frame can be changed from Days to Weeks to Months. On the right are other properties such as Chart Title, format for X and Y axes, X-Axis Title, and Minimum and Maximum Scale for the Y-Axis.

What makes the data work is modifying the SQL of the query that the graph is based on, qGraph.

This example also illustrates the method I use to cascade comboboxes. I put the SQL with no criteria in the Tag property of each respective combo then send the criteria and the control to a function I wrote called SetControl_RowSource, which is usually a public function. This example, however, embeds it behind the form that uses it and declares it to be private.

Double-click a date to popup a calendar form called f_PopupCalendar. If a date OpenArg is sent to the form, it will set the calendar to that date and not store it. This is done on the second date of the date range for cases when Date1 is specified but not Date2.


goto Top


Popup Calendar posted on Rogers Access Library

video - Tool and Code: Graphs and Charts in Microsoft Access (cc)

related videos to Customize the QAT (Quick Access Toolbar)

Access QAT (Quick Access Toolbar): Alignment Icons (cc)

> Tip: Add Save As Icon to QAT (cc) - Franšais, Dutch, Deutsch, English


If you have comments or want to tell me how my Graph Example helped you, thank you — or you want me to connect to you and guide you while you build your application, .

goto Top

Free Book on Access: Access Basics

Free Tutorials: Video Tutorials

for information on private programming and training, email

Copyright © 2014 Crystal Long. All rights reserved. | Last Updated: Aug 2014