Results 1 to 4 of 4

Thread: ado newbie

  1. #1
    Join Date
    Feb 2003
    Posts
    107

    Unanswered: ado newbie

    I have some logic to connect to a database, and add new records. I'm getting an error message that the SQL statement is invalid on the open method of the recordset. I actually don't even want to select anything. All I want to do it connect to the database, then add a number of records (in batch if possible) and then test to ensure it's saved.

    My code follows below. (the connect method is just pseudocode - i know it works)

    Public Function ConnectGIS() as boolean
    if goConn.Open strConnectionstring Then
    ConnectGIS = True
    end if
    End Function

    Public Function UploadNewRecords() as boolean
    If ConnectGIS Then
    With oNewIssues
    .Source = gisSchemaName & ".ISSUES"
    .ActiveConnection = goConn
    .CursorType = adOpenStatic
    oNewIssues.Open "Select * from " & gisSchemaName & ".ISSUES"
    For i = 0 To oIssues.Count - 1
    .AddNew
    ipos = InStr(1, oIssues.Item(i), "-")
    .Fields("GEO_ID") = Mid(oIssues.Item(i), 1, ipos - 1)
    .Fields("ISSUE_CLASS") = Mid(oIssues.Item(i), ipos + 1, InStr(ipos + 1, oIssues.Item(i), "-"))
    Next
    .UpdateBatch

    UploadIssuesToGIS = True
    DisconnectGIS
    Exit Function
    End If
    End With
    Else
    mstrError = "Unable to connect to the GIS database at this time"
    UploadIssuesToGIS = False
    End If
    End Function

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    What value does gisSchemaName have when you call oNewIssues.Open? Also, I'm assuming you're hitting SQL Server, since you didn't specify?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Feb 2003
    Posts
    107
    gisschemaname is DTAADMIN and database is oracle.

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Are you absolutely sure your variable holds the value you're expecting it to at the exact moment your assigning source?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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