Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: How to Format a Label for Each Axis of a Graph


View products that this article applies to.

Summary

The Microsoft Access Chart Wizard enables you to format a label for each axis of a chart or graph. You can modify the label formats in Microsoft Graph, and then save those changes for later use. When it is not possible to simply reformat the data in Microsoft Graph, you should apply the formatting you want before the information is sent to the chart.

↑ Back to the top


More information

When a chart is created, the nature of the chart and/or the type of grouping may require a temporary modification of the data that is sent to the chart.

This modification takes place in the SQL statement that is generated for the chart by the Chart Wizard. In the example cited for this article, a Date field is converted to an integer number using the Year() function. Because this data is no longer a Date data type, it cannot be formatted using the available Date formats.

When a chart is created using the Chart Wizard, a SQL statement is built. This statement is placed in the RowSource property of the chart object. Each time the form or report in which the chart resides is refreshed, the SQL statement is re-run, and the results are sent to Microsoft Graph.

How to Change the Format of the Labels in a Chart

To change the format of the labels in a chart, follow these steps:
  1. Open the sample database Northwind.mdb.
  2. On the Insert menu, click Form.
  3. In the New Form dialog box, click Chart Wizard, select the Orders table in the Choose the table....comes from list box, and then click OK.
  4. In the Chart Wizard dialog box, under Available Fields, select the OrderDate field, and then add it to the Fields for Chart list.
  5. Repeat step 4 for the Freight field, and then click the Next button two times to accept the defaults.
  6. Double-click the X-Axis label OrderDate by month.
  7. In the Group dialog box, click Year, and then click OK.
  8. Click Finish. Note that the labels for the axes are 1996, 1997, 1998, and 2000.

Changing the Label Format

  1. On the View menu, click Design View.
  2. Select the chart. If the property sheet is not displayed, on the View menu, click Properties.
  3. Right-click the RowSource property, and then click Build on the shortcut menu.
  4. Change the Year([OrderDate]) field to Format([OrderDate],"YY").
  5. Run the query to verify that the years in the OrderDate column are formatted as follows: 96, 97, 98, 00.
  6. Close the query, and then save the changes.
  7. Switch the form to Form view. Note that the labels of the axes are now formatted as: 96, 97, 98, 00.

↑ Back to the top


References

For more information about editing charts, click Microsoft Access Help on the Help menu, type edit a chart in a form or report in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


Keywords: KB208515, kbinfo, kbhowto

↑ Back to the top

Article Info
Article ID : 208515
Revision : 3
Created on : 6/28/2004
Published on : 6/28/2004
Exists online : False
Views : 408