VBKid04
04-14-2004, 09:22 AM
I am wanting to display a bar chart and a pie chart.
Not sure if MSChart is the correct method for a pie chart but maybe someone can tell me?
I have an MSChart control on my page, which I have populated by the use of this code:
' NOTE: Have set a reference to the Microsoft ActiveX Data
' Objects 2.0 Library.
Private rsTask As New ADODB.Recordset
Private cn As New ADODB.Connection
Private Sub Form_Load()
Dim strQuery As String
cn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & _
"C:\MyDatabase.mdb"
cn.Open
strQuery = "SELECT TaskID, CustomerID" & _
"FROM Products WHERE CustomerID=1"
rsTask.Open strQuery, cn, adOpenKeyset
With MSChart1
.ShowLegend = True
Set .DataSource = rsTask
End With
End Sub
But I cannot get anything to display on it!
Can anyone please tell me what I am doing wrong ?
And also tell me how to get a pie chart?
Thanks.
Not sure if MSChart is the correct method for a pie chart but maybe someone can tell me?
I have an MSChart control on my page, which I have populated by the use of this code:
' NOTE: Have set a reference to the Microsoft ActiveX Data
' Objects 2.0 Library.
Private rsTask As New ADODB.Recordset
Private cn As New ADODB.Connection
Private Sub Form_Load()
Dim strQuery As String
cn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & _
"C:\MyDatabase.mdb"
cn.Open
strQuery = "SELECT TaskID, CustomerID" & _
"FROM Products WHERE CustomerID=1"
rsTask.Open strQuery, cn, adOpenKeyset
With MSChart1
.ShowLegend = True
Set .DataSource = rsTask
End With
End Sub
But I cannot get anything to display on it!
Can anyone please tell me what I am doing wrong ?
And also tell me how to get a pie chart?
Thanks.