Microsoft KB Archive/285848

= ACC2002: PivotChart Series Formatting Is Lost in Linked Subforms =

Article ID: 285848

Article Last Modified on 11/6/2003

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q285848



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

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SYMPTOMS
When you scroll through records on a form that contains a linked subform in PivotChart view, you notice that the formatting for individual series in the PivotChart is lost. For example, trendlines, error bars, and data labels are discarded, and formatting properties such as color and border weight are reset to their defaults.



CAUSE
The PivotChart Web Component is architected to reset formatting when there is no data to format in a series.



RESOLUTION
Write custom Visual Basic for Applications code to programmatically format the members of the PivotChart from the Current event of the main form. To programmatically format series members of a subform in PivotChart view, follow these steps:  Open the sample database Northwind.mdb. On the Insert menu, click Form. In the New Form dialog box, click AutoForm: Columnar, click the Employees table in the Choose the table or query where the object's data comes from box, and then click OK. The new form opens in form view. On the View menu, click Design View. Delete all controls except the EmployeeID, FirstName, and LastName controls. In the Database window, drag the Sales Analysis Subform2 form to the new form.</li> Set the LinkMasterFields and LinkChildFields properties of the subform to LastName.</li> On the View menu, click Code.</li> On the Tools menu, click References.</li> In the References dialog box, click Browse, and locate the C:\Program Files\Common Files\Microsoft Shared\Web Components\10\OWC10.DLL file.</li> Click Open to select the file.</li> Click OK to close the References dialog box.</li>  Add the following code to the module of the form: Private Sub Form_Current Dim objChartSpace As OWC10.ChartSpace Dim objChart As OWC10.ChChart Dim objSeries As OWC10.ChSeries Set objChartSpace = Me.PivotChart.Form.ChartSpace Set objChart = objChartSpace.Charts(0) For Each objSeries In objChart.SeriesCollection With objSeries 'Set Border weight to Thick .Border.Weight = owcLineWeightThick

'Set Border Color to Black .Border.Color = 0

'Set Border style to Solid .Border.DashStyle = chLineSolid 'Add an Error bar if one doesn't exist If .ErrorBarsCollection.Count = 0 Then .ErrorBarsCollection.Add End If

'Add a trendline if one doesn't exist If .Trendlines.Count = 0 Then .Trendlines.Add

'Set trendline color to Aquamarine .Trendlines.Item(0).Line.Color = &quot;AquaMarine&quot;

'Turn off Trendline equation and R-Squared value .Trendlines.Item(0).IsDisplayingEquation = False .Trendlines.Item(0).IsDisplayingRSquared = False End If     End With Next End Sub </li> On the File menu, click Close and Return to Microsoft Access.</li> On the File menu, click Save.</li> On the View menu, click Form View.</li> Scroll through each record on the main form.</li></ol>

Note that the PivotChart contains an error bar and trendline, and that individual series members retain their formatting.

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

<div class="moreinformation_section">

MORE INFORMATION
When multiple series of data are being displayed in a PivotChart, it is possible to customize the formatting of each individual series. However, when the PivotChart is filtered where a series is not displayed, the formatting for that series is reset to the defaults.

For example, suppose the linked subform is displaying data for &quot;Davolio.&quot; In this case, all other series do not exist within the PivotChart. Because the series members no longer exist, the PivotChart Web component has discarded their formatting. When you scroll to another record on the main form, the series is re-created and contains the default formatting.

Steps to Reproduce the Behavior

 * 1) Open the sample database Northwind.mdb.
 * 2) Open the Sales Analysis Subform2 form in PivotChart view.
 * 3) On the View menu, click Properties.
 * 4) In the property sheet, click the General tab, click the arrow in the Select combo box, and then click Buchanan.
 * 5) Under the Add section, click Add Errorbar.
 * 6) Repeat steps 4 through 5 for other series of the chart (Callahan, Davolio, Dodsworth, Fuller, and King). Note that each series now has an error bar.
 * 7) Close the form.
 * 8) On the Insert menu, click Form.
 * 9) In the New Form dialog box, click AutoForm: Columnar, click the Employees table in the Choose the table or query where the object's data comes from box, and then click OK. The new form opens in Form view.
 * 10) On the View menu, click Design View.
 * 11) Delete all controls except the EmployeeID, FirstName, and LastName controls.
 * 12) In the Database window, drag the Sales Analysis Subform2 form to the new form.
 * 13) Set theLinkMasterFields and LinkChildFields properties of the subform to &quot;LastName.&quot;
 * 14) On the View menu, click Form View. Note that the PivotChart subform displays a chart with error bars as you would expect.
 * 15) On the Edit menu, point to Go To, and then click Next.

Note that the PivotChart subform loses its formatting for individual series members. The error bars have been removed, and each series is displayed using the same color.

Additional query words: pra not there gone missing

Keywords: kbbug kbnofix KB285848

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.