Results 1 to 2 of 2

Thread: SHAP(E)ing Data

  1. #1
    Join Date
    Oct 2004
    Oxfordshire, UK

    Unanswered: SHAP(E)ing Data

    Hi all,

    I'm trying to use SHAPE to get data into a MSHFlexGrid control on a form in a secured Access database but I'm falling at the first hurdle. I get a 3079 error "The connection cannot be used to perform this operation. It is either closed or invalid in this context" when I attempt to create an ADODB.Recordset like this:

    Dim strConnection As String
    Dim strSQLBand0 As String
    Dim strSQLBand1 As String

    'Get Data Provider.
    strConnection = "Data Provider=Microsoft.Jet.OLEDB.4.0;"

    'Get Data Source and System Database from existing connection.
    With CurrentProject.Connection
    strConnection = strConnection & "Data Source=" & .Properties("Data Source") & ";"
    strConnection = strConnection & "Jet OLEDBystem database=" & .Properties("Jet OLEDBystem database") & ";"
    End With

    'Open new connection object.
    Set cnnShape = New ADODB.Connection
    With cnnShape
    .Provider = "MSDataShape"
    .Open strConnection, [UserID], [Password]
    End With

    strSQLBand0 = "SELECT tblCustomer.strCustomer, tblCustomer.strCustomer_ID FROM tblCustomer;"
    strSQLBand1 = "SELECT tblJob.lngWorks_Order, tblJob.strCustomer_ID FROM tblJob;"

    Set rstCustomer = New ADODB.Recordset
    rstCustomer.Open "SHAPE (" & strSQLBand0 & ") APPEND ((" & strSQLBand1 & ") RELATE strCustomer_ID TO strCustomer_ID) AS rsJob"

    Any ideas would be appreciated.

  2. #2
    Join Date
    Oct 2004
    Oxfordshire, UK
    Please ignore this. I failed the idiot test and forgot to add the connection object(!)

Posting Permissions

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