Results 1 to 2 of 2

Thread: MSChart - setting the Datasource to a recordset?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2004
    Posts
    101

    Red face 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

  2. #2
    Addicted Member Mage's Avatar
    Join Date
    Jan 2003
    Location
    London- Org SA
    Posts
    134

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width