Access_guy49
Registered User.
- Local time
- Today, 03:50
- Joined
- Sep 7, 2007
- Messages
- 462
Hey Everyone, I am in a REAL jam
(Hey.. what's the difference between jam and jelly... nvm i'll save it for the joke board.)
Ok I have a Simple Form with two charts. The record source for these charts is set using vba on a previous form.
I have it so that i can have the user change the chart type with a button on the form. but i'm trying to add a trendline and it's just not happening for me.
This works just fine:
This however, is a friggin disaster.... and here is the kicker.. The first graph it runs through, it actually DOES create a trendline.. but it errors out, so i was trying to catch it and force it to continue but on the second chart it doesn't continue. It has a problem getting the series collection
Ideas? anyone?
(Hey.. what's the difference between jam and jelly... nvm i'll save it for the joke board.)
Ok I have a Simple Form with two charts. The record source for these charts is set using vba on a previous form.
I have it so that i can have the user change the chart type with a button on the form. but i'm trying to add a trendline and it's just not happening for me.
This works just fine:
Code:
Private Sub cmd_changeGraph_Click()
'change graph to bar
Me.Graph1.Object.Application.Chart.ChartType = 51
Me.Graph3.Object.Application.Chart.ChartType = 51
End Sub
This however, is a friggin disaster.... and here is the kicker.. The first graph it runs through, it actually DOES create a trendline.. but it errors out, so i was trying to catch it and force it to continue but on the second chart it doesn't continue. It has a problem getting the series collection
Code:
Private Sub Command10_Click()
'Add 10 year trend line
Dim i As Integer
i = 0
If ThYrTrends = True Then
'Remove thirty year trends first
Me.Graph1.SeriesCollection(1).Trendlines(1).Select
Selection.Delete
Me.Graph3.SeriesCollection(1).Trendlines(1).Select
Selection.Delete
End If
On Error GoTo Ohwell
Me.Graph1.SeriesCollection(1).Trendlines.Add(Type:=xlMovingAvg, Period:= _
10, Forward:=0, Backward:=0, DisplayEquation:=False, DisplayRSquared:= _
False, Name:="10yr Mov. Avg").Select
NextGraph:
Me.Graph3.SeriesCollection(1).Trendlines.Add(Type:=xlMovingAvg, Period:= _
10, Forward:=0, Backward:=0, DisplayEquation:=False, DisplayRSquared:= _
False, Name:="10yr Mov. Avg").Select
Ohwell:
'Do nothing
Me.Form.Refresh
If i = 0 Then
i = 1
GoTo NextGraph
End If
TenYrTrends = True
End Sub
Ideas? anyone?