Helllo to everybody ,
I've this problem with Access 2010 and VBA.
I want to create a timeline graph in a report.
So using VBA I create a table (called tbTimeline1) with data to be printed on graph included in a report. Table structure is the following
ID Auto
ItemDescr String
Start Date
End Date
Duration Long Integer
I create timeline graph printing a serie on a X-Y Scatter plot where X is the time and Y is the distance of the point from X Axis.
Then I customize each point datalabel with item description and duration should be printed using Duration field content.
Here is the code for printing Datalabels and ErrorBars.
I use Custom ErrorBars and two variant array for Plus and Minus values.
ReDim vntPlus(grphChart.SeriesCollection(1).Points.Count)
ReDim vntMinus(grphChart.SeriesCollection(1).Points.Count)
grphChart.SeriesCollection(1).HasErrorBars = True
vntPlus = Array(100, 200, 300)
vntMinus = Array(1, 1, 1)
Do While Not rst.EOF
i = i + 1
With grphChart.SeriesCollection(1).Points(i)
.HasDataLabel = True
.DataLabel.Text = CStr(rst.Fields("ItemDescr"))
.DataLabel.Font.Size = 8
.DataLabel.Font.Name = "Arial Narrow"
.DataLabel.Font.Bold = False
.DataLabel.Font.Italic = True
.DataLabel.Position = xlLabelPositionLeft
vntPlus(i) = rst.Fields("Duration")
vntMinus(i) = 0
End With
rst.MoveNext
Loop
With grphChart.SeriesCollection(1)
.ErrorBar Direction:=xlX, _
Include:=xlErrorBarIncludePlusValues, _
Type:=xlErrorBarTypeCustom, _
Amount:=vntPlus, MinusValues:=vntMinus
End With
An error -1004 is raised on row containing .ErrorBar method.
The strange thing is that on the chart included in the report I can't see the "Custom Error Bar" option. Is it an option available in Access? Is it available only in Excel?
Is there anyone that can help me fix this code snippet?
Thank you in advance,
Wiz
I've this problem with Access 2010 and VBA.
I want to create a timeline graph in a report.
So using VBA I create a table (called tbTimeline1) with data to be printed on graph included in a report. Table structure is the following
ID Auto
ItemDescr String
Start Date
End Date
Duration Long Integer
I create timeline graph printing a serie on a X-Y Scatter plot where X is the time and Y is the distance of the point from X Axis.
Then I customize each point datalabel with item description and duration should be printed using Duration field content.
Here is the code for printing Datalabels and ErrorBars.
I use Custom ErrorBars and two variant array for Plus and Minus values.
ReDim vntPlus(grphChart.SeriesCollection(1).Points.Count)
ReDim vntMinus(grphChart.SeriesCollection(1).Points.Count)
grphChart.SeriesCollection(1).HasErrorBars = True
vntPlus = Array(100, 200, 300)
vntMinus = Array(1, 1, 1)
Do While Not rst.EOF
i = i + 1
With grphChart.SeriesCollection(1).Points(i)
.HasDataLabel = True
.DataLabel.Text = CStr(rst.Fields("ItemDescr"))
.DataLabel.Font.Size = 8
.DataLabel.Font.Name = "Arial Narrow"
.DataLabel.Font.Bold = False
.DataLabel.Font.Italic = True
.DataLabel.Position = xlLabelPositionLeft
vntPlus(i) = rst.Fields("Duration")
vntMinus(i) = 0
End With
rst.MoveNext
Loop
With grphChart.SeriesCollection(1)
.ErrorBar Direction:=xlX, _
Include:=xlErrorBarIncludePlusValues, _
Type:=xlErrorBarTypeCustom, _
Amount:=vntPlus, MinusValues:=vntMinus
End With
An error -1004 is raised on row containing .ErrorBar method.
The strange thing is that on the chart included in the report I can't see the "Custom Error Bar" option. Is it an option available in Access? Is it available only in Excel?
Is there anyone that can help me fix this code snippet?
Thank you in advance,
Wiz