Change Graphs and Charts in Microsoft Access with VBA

Play Change Graphs and Charts in Microsoft Access with VBA


Do you want to know how to programmatically change graphs and charts in Access? This 19-minute video shows how to use VBA to drive charts from a menu form that collects criteria, change data for the graph, set the chart title, x-axis title, and modify scales and formats. To download the database example, go to then Free Tools then Graphing in Access.

The menu form is called f_Graph_MENU. It has a button ("Chart") that runs VBA code and opens the graph. The time frame can be changed from Days to Weeks to Months. Appearance is changed by setting format. How data looks and what data is being displayed is based on criteria such as a possible start date or date range. On the right are other properties that are read when the graph is rendered such as Chart Title, format for X and Y axes, X-Axis Title, and Minimum and Maximum Scale for the Y-Axis.

The f_Graph form has what is now called the Microsoft Graph Chart control, and has code behind the form to change where the data comes from and how it looks.

The f_PopupCalendar form is for collecting dates and generally triggered by double-clicking a control with a date. If a date OpenArg is sent, the starting calendar date can be specified if the control has no value.

The sample tables are called t_GraphData and t_GraphTopics.

The qGraph query is the RowSource for the Microsoft Graph Chart control. By defining a query and then modifying the SQL for the query before the chart is opened, you can get exactly what you want.

you also may be interested in

How To Make a Graph with Microsoft Access

 if you want to show graphs and symbols in queries, watch:

Show Bar Graphs! in Access Query using Unicode characters


Triangles! and Circles! in a Microsoft Access Query -- Get Previous Record too


please Subscribe, Like, Comment, and Share ~ thank you




Download this episode

Download captions

The Discussion

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.