Microsoft Access VBA Macro Programming

(Tina Sui) #1

Chapter 34 Drill Down on Charts


Chapter 34 Drill Down on Charts


R


ecently, I was involved in an Excel application that allowed the user to drill down
on a chart. They could view a balloon chart, and then click a particular balloon
and a new balloon chart would appear giving the detail on the element that they
originally clicked.
This used a class module and the methodGetChartElement. It was extremely impressive
to see it in action and users liked the functionality.
It occurred to me that this ought to be possible in Access as well. The problem is that a
different charting engine is used and theGetChartElementmethod does not exist.
However, using API calls and a little lateral thinking, this is still possible.
The first step is to create a simple table in Access by clicking Create on the Access menu
and then choosing the Table Design icon in the Tables group of the ribbon. Create the
following fields:


 Currency Text
 Va l Number, Double

Populate the table as shown in Table 34-1.
Save the table astblCurrency. On your blank form, drag a chart object onto the form.
Make your currency table the row source for the chart. Select a pie chart as the chart type.
Right-click the chart and select Chart Object and then Edit on the pop-up menu. Right-click
the chart object and select Chart Options on the pop-up menu.
Click the Data Labels tab in the pop-up window and check the box for Category Name in
the Label Contains section. Your pie chart should now show the currency indicator on the
appropriate segment.


325

Free download pdf