Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Weirdest(to infinity) Graph Problem in Access 97

0 views
Skip to first unread message

Jac

unread,
Nov 26, 2002, 5:52:17 AM11/26/02
to
Posted a week ago under similar heading, Weirdest Graph
Problem.
Cant believe that i'm still struggling with this bug. Itz
drving me nuts.

To summarise, my form is able to take-in some user inputs
via combo boxes and a chart will be displayed (initiated
through a command button) based on the selection from user
inputs.

Traced through my program and realised that the rowsource
data is fine.
However, during the first load of the chart object, the
value(y)-scale always used the values(ie. max, min, major,
minor) from the previous set of data.

Here's my 2-cents worth if anyone is interested;
When the rowsource ppty is set in design view, the value-
scale populates correctly.
However, when the rowsource ppty is set via vba in runtime
mode, the value-scale will always take the previous set of
data.
The funny thing is that when i manually step through the
vba code, everything works perfectly. It just doesn't work
in automation.
What's happening?

Attached is the sample db that i found from microsoft that
can be used to simulate the bug in my program.


Article #: 186855 - ACC97: Microsoft Access 97 Sample
Graphs Available in Download Center
http://support.microsoft.com/default.aspx?scid=kb;en-
us;186855


Upon installation, Look for the form - frmChangeScale

Attached is the code that i used to simulate/solve the bug.

===========================================================
===========================
Private Sub btnUpdChart_Click()
Dim sqlstring As String
Dim objcht As Object

Dim i As Integer

Set objcht = Me![graphorders].Object.Application.Chart

On Error Resume Next

'----------------------------------------------------------
---------
'This procedure sets the properties of the axes object to
the values
'typed in the text boxes on the form. For instance, it
uses the
'minimumscale text box to fill the minimumscale property
of the axes
'object and so on. If text box has a null, it does not use
it and thus
'avoids an error.
'----------------------------------------------------------
---------
sqlstring = "SELECT Orders.EmployeeID, Count
(Orders.OrderID) AS [CountOfOrder ID] FROM Orders GROUP BY
Orders.EmployeeID;"
Me![graphorders].RowSource = sqlstring
Me![graphorders].Requery

With objcht.Axes(xlValue)
.minimumscale = CDbl(Me![minscale])
.maximumscale = CDbl(Me![maxscale])
.minorunit = CDbl(Me![minorunit])
.majorunit = CDbl(Me![majorunit])
End With

'the next 4 lines of code have the same effect as the
above 6 lines.
'Me![graphorders].Object.Application.Chart.axes
(2).minimumscale = _
CDbl(Me![minscale]) 'Set the minimum scale
' Me![graphorders].Object.Application.Chart.axes
(2).maximumscale = _
CDbl(Me![maxscale]) 'Set the maximum scale
' Me![graphorders].Object.Application.Chart.axes
(2).minorunit = _
CDbl(Me![minorunit]) 'Set the minor unit
' Me![graphorders].Object.Application.Chart.axes
(2).majorunit = _
CDbl(Me![majorunit]) 'Set the major unit
objcht.Refresh
Set objcht = Nothing

End Sub

0 new messages