Hi
I am having difficulty displaying data in an MSChart control via an ADO recordset where the data is retreived iteratively using an ADO recordset connected to an Access database. The context is a student assessment database which stores "Surname", Attainment, Effort and Behaviour in a single MS Access 97 table 'tblAssessment'. The program iterates through the database records (rows) and retreives data for display in the MS Chart - 'MSChart'.
Problem is the X-Axis labels corectly show the first (and only) 10 surnames, but then 'adds' 'R1' as the 11th Label! The Y Axis values for the data set are not sensible. The chart seems calibrated 0-100, displaying data values up to about this value. Yet, the data values can only vary (integers) between 1 and 4.
If I connect the MS Chart to an ADO data control. set the parameters and bind the MS Chart object to this the data is displayed OK. But, I need my solution to develop to take control over the data displayed and that is why I would like my algorithm to work.
Hope you can help.
In anticipation, many thanks
I am having difficulty displaying data in an MSChart control via an ADO recordset where the data is retreived iteratively using an ADO recordset connected to an Access database. The context is a student assessment database which stores "Surname", Attainment, Effort and Behaviour in a single MS Access 97 table 'tblAssessment'. The program iterates through the database records (rows) and retreives data for display in the MS Chart - 'MSChart'.
Problem is the X-Axis labels corectly show the first (and only) 10 surnames, but then 'adds' 'R1' as the 11th Label! The Y Axis values for the data set are not sensible. The chart seems calibrated 0-100, displaying data values up to about this value. Yet, the data values can only vary (integers) between 1 and 4.
If I connect the MS Chart to an ADO data control. set the parameters and bind the MS Chart object to this the data is displayed OK. But, I need my solution to develop to take control over the data displayed and that is why I would like my algorithm to work.
Hope you can help.
In anticipation, many thanks
Code:
Private Sub Command2_Click()
Set conn = New ADODB.Connection
Set rsAssessment = New ADODB.Recordset
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & "C:\temp\dbChartPrimer.mdb" & " ;Persist Security Info = false"
conn.Open
rsAssessment.Open ("SELECT Surname, Effort, Attainment,Behaviour FROM tblAssessment"), conn, adOpenStatic, adLockReadOnly
Dim i As Integer
i = 1
MSChart.RowCount = 1
MSChart.RowLabelCount = 1
MSChart.Title = "Assessment - Year 7"
'MSChart.Backdrop
With rsAssessment
.MoveFirst
Do While Not .EOF
MSChart.Row = i
MSChart.Data = .Fields("Effort")
MSChart.RowLabel = .Fields("Surname")
MSChart.RowCount = MSChart.RowCount + 1
MSChart.RowLabelCount = MSChart.RowLabelCount + 1
i = i + 1
.MoveNext
Loop
End With
rsAssessment.Close
conn.Close
Set conn = Nothing
End Sub