Microsoft KB Archive/99398

{|
 * width="100%"|

ACC1x: How to Format a Label for Each Axis of a Graph (1.x)

 * }

Q99398

-

The information in this article applies to:


 * Microsoft Access versions 1.0, 1.1
 * Microsoft Graph 3.0

-

SUMMARY
Advanced: Requires expert coding, interoperability, and multiuser skills.

The Microsoft Access Graph Wizard does not give users the option to format a label for each axis of the graph. You can modify the labels in Microsoft Graph, but this change is not permanent. The next time the graph is updated, the formatting is lost.

This article describes the steps to change the format permanently by modifying the information that Microsoft Access sends to Microsoft Graph.

For information on this subject in later versions of Microsoft Access, please see the following article in the Microsoft Knowledge Base:

Q147193 ACC: How to Format a Label for Each Axis of a Graph

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

This SQL statement can be modified by the user. We recommend that you copy it to a new query, where you can test your changes.

The example below describes the steps to change the format of the labels in a graph:

Procedure A - Create the Graph

 * 1) Open the sample database NWIND.MDB. In the Database window, select the Orders table.
 * 2) On the menubar, choose the Forms button to create a new form.
 * 3) Choose Form Wizards. Select Graph, and then choose OK.
 * 4) To accept the defaults, press Next when the following message appears: &quot;Which type of graph do you want?&quot;
 * 5) Select the Order Date field from the Available Fields list and choose the right arrow to add it to the Fields for Graph list.
 * 6) Repeat step 5 for Freight, then choose Next twice to accept the default (Group [Order Date] by: Year). Choose Open. Note that the labels for the axes are: 1989, 1990, 1991, 1992

Procedure B - Changing the Label Format

 * 1) Switch to Design view. Select the chart object and display the property sheet.
 * 2) Place your insertion point in the RowSource property and press SHIFT+F2 to open the Zoom window.
 * 3) Highlight the entire SQL Statement to select it. Press CTRL+C to copy it to the Clipboard.
 * 4) Create a new query by choosing the Query button on the menubar.
 * 5) From the View menu, choose SQL.
 * 6) Highlight all the text in the SQL dialog box to select it. Press CTRL+V to replace the existing text with the Clipboard contents.
 * 7) Choose OK. The fields [Order Date] and [Order Amount] are placed in the query grid.
 * 8) Change the field Year([Order Date]) to Format([Order Date],&quot;YY&quot;). Execute the query to verify that the years in the Order Date column are formatted as follows: 89, 90, 91, 92.
 * 9) Switch to Design view. Copy the contents of the SQL dialog box to the Clipboard.
 * 10) Return to the form. Select the chart object and paste the contents of the Clipboard into the RowSource property.
 * 11) Switch to Form view. The labels of the axes should now read as follows: 89, 90, 91, 92.