Been pushing some boundaries and TRAWLED the internet for solutions - so nearly cracked this now but now Access hangs each time I run the following code. It is Access 2000 with a graph on a form.
Basically it is a scattergraph - and I need to produce a separate report for each school (I have already cracked the export to pdf and bypass file dialog) but this should move all the datalabels behind a white rectangular square on the graph EXCEPT for the one I want to show - and then I label it
This is the ONLY solution I can find as you cannot only have a data label for a singular point. problem is it freezes whenever it gets to:
For Each chtLabel In chtSeries.DataLabels
References are:
Microsoft graph 9.0 object library
and DAO 3.51
Snippets of code below that are important - any help VERY DESIRABLE !!
Thanks!
Dim cht As Graph.Chart
Dim chtSeries As Graph.Series
Dim chtLabel As Graph.DataLabel
Dim RecordNumber As String
Dim db As DAO.Database
Dim rst As DAO.Recordset ' The graph data
Dim rst2 As DAO.Recordset ' The schools data
Dim sql As String
Dim sql2 As String
Dim DFESLabel As String
Dim DFESRecordNumber As Integer
Dim CurrentRecordNumber As Integer
Set cht = Me.MyGraph.Object
For Each chtSeries In cht.SeriesCollection
'Reset label postions
chtSeries.HasDataLabels = False
'Enable Data Labels in the chart
chtSeries.HasDataLabels = True
'Loop through each data label and set its
'Top, Left, and Font properties
' *** this next line is where it always hangs ***
For Each chtLabel In chtSeries.DataLabels
CurrentRecordNumber = CurrentRecordNumber + 1
If CurrentRecordNumber <> DFESRecordNumber Then
chtLabel.Top = 0
chtLabel.Left = 0
chtLabel.Font.Size = 8
Else
'Get school name
sql2 = "SELECT tblSchools.SchoolName, tblSchools.DFES
FROM tblSchools WHERE (((tblSchools.DFES)='" & DFESLabel & "'))"
Debug.Print sql2
Set rst2 = db.OpenRecordset(sql2)
Label23.Caption = rst2![SchoolName]
chtLabel.Text = DFESLabel
chtLabel.Font.Size = 8
End If
Next
Next
etc etc etc

Andy Kent
Basically it is a scattergraph - and I need to produce a separate report for each school (I have already cracked the export to pdf and bypass file dialog) but this should move all the datalabels behind a white rectangular square on the graph EXCEPT for the one I want to show - and then I label it
This is the ONLY solution I can find as you cannot only have a data label for a singular point. problem is it freezes whenever it gets to:
For Each chtLabel In chtSeries.DataLabels
References are:
Microsoft graph 9.0 object library
and DAO 3.51
Snippets of code below that are important - any help VERY DESIRABLE !!
Thanks!
Dim cht As Graph.Chart
Dim chtSeries As Graph.Series
Dim chtLabel As Graph.DataLabel
Dim RecordNumber As String
Dim db As DAO.Database
Dim rst As DAO.Recordset ' The graph data
Dim rst2 As DAO.Recordset ' The schools data
Dim sql As String
Dim sql2 As String
Dim DFESLabel As String
Dim DFESRecordNumber As Integer
Dim CurrentRecordNumber As Integer
Set cht = Me.MyGraph.Object
For Each chtSeries In cht.SeriesCollection
'Reset label postions
chtSeries.HasDataLabels = False
'Enable Data Labels in the chart
chtSeries.HasDataLabels = True
'Loop through each data label and set its
'Top, Left, and Font properties
' *** this next line is where it always hangs ***
For Each chtLabel In chtSeries.DataLabels
CurrentRecordNumber = CurrentRecordNumber + 1
If CurrentRecordNumber <> DFESRecordNumber Then
chtLabel.Top = 0
chtLabel.Left = 0
chtLabel.Font.Size = 8
Else
'Get school name
sql2 = "SELECT tblSchools.SchoolName, tblSchools.DFES
FROM tblSchools WHERE (((tblSchools.DFES)='" & DFESLabel & "'))"
Debug.Print sql2
Set rst2 = db.OpenRecordset(sql2)
Label23.Caption = rst2![SchoolName]
chtLabel.Text = DFESLabel
chtLabel.Font.Size = 8
End If
Next
Next
etc etc etc
Andy Kent