MSChart - setting the Datasource to a recordset?
Am trying to use the MSChart here...
Was instructed to use it I should first:
-Open an ADODB recordset
-Set MSChart1.DataSource = recordset
but I can't get it working...
I have tried:
Code:
Dim chartRS As ADODB.Recordset
Set chartRS = New ADODB.Recordset
chartRS.Open "Select CustomerID, TaskID From CUSTOMER WHERE CUSTOMER.TaskID=TASK.TaskID"
Set MSChart1.DataSource = chartRS
but this brings up the error:
Run time error 3709:
Operation is not allowed on an object referencing a closed or invalid connection
-> Highlighting in yellow the line:
chartRS.Open "Select CustomerID, TaskID From CUSTOMER WHERE CUSTOMER.TaskID=TASK.TaskID"
I have also tried:
Code:
Dim chartRS As String
chartRS = "Select TaskID, CustomerID FROM TASK"
db.Execute chartRS
Set MSChart1.DataSource = chartRS
but this brings up the error:
Compile Error - object required
-> Highlighting in blue "chartRS" in the line Set MSChart1.DataSource = chartRS
Can anyone please aid me in getting this working?
Thanks
Re: MSChart - setting the Datasource to a recordset?
[QUOTE]I have tried:
Code:
Dim chartRS As ADODB.Recordset
Set chartRS = New ADODB.Recordset
chartRS.Open "Select CustomerID, TaskID From CUSTOMER WHERE CUSTOMER.TaskID=TASK.TaskID"
Set MSChart1.DataSource = chartRS
I am having a problem with MSChart as well but mine excepting ther data but not displaying anything. your problem with you recordset is you dont have a connection
Code:
Dim chartRS As ADODB.Recordset
Set chartRS = New ADODB.Recordset
chartRS.Open "Select CustomerID, TaskID From CUSTOMER WHERE CUSTOMER.TaskID=TASK.TaskID","(adodb.connection here! or the connection string)"
Set MSChart1.DataSource = chartRS