Error 3146: ODBC-call failed with ODBC-direct

Error 3146: ODBC-call failed with ODBC-direct

Post by schmitt_roque.. » Thu, 25 Jun 1998 04:00:00


sorry for the x. qustion on 3146, but the discussion above could not
help me !

Her my problem:

I try to use ODBC-direct instead of DAO, because we need the
'Batch-Update'-Feature. I found in the VB-documentation an example and
tried the following code.
The example loads the data from the table 'personal' (northwind.mdb)
in the recordset. Then i add 3 NEW records with the combination of
AddNew/ Update.
After adding these records i try to actualize the database with update
and the parameter dbUpdateBatch.

But now i get this error-code :
3146:  ODBC--call failed.
-3517:  S1001: [Microsoft][ODBC Microsoft Access 97 Driver] Characters
found after end of SQL statement.
3146:  ODBC--call failed.

Can somebody please look at my code and help me ?
Does anybody has a idea ?

Best regards

PS: the database is available. I use the same database and the same
table with other parts of this programm (normal DAO !)

Sub example_AddNew_withproblem()

    Dim wrkODBCdirekt As Workspace
    Dim conNorthwind As Connection
    Dim rstODBCPersonal As Recordset

    Dim wrkName As String
    Dim wrkDefaultUser As String
    Dim wrkDefaultPassw As String
    Dim wrkDefaultType As Integer

    Dim strFirstName As String
    Dim strLastName As String

    On Error GoTo TrapErrors

    ' Workspace based on ODBC-direct
    wrkName = ""
    wrkDefaultUser = "Admin"
    wrkDefaultPassw = ""
    wrkDefaultType = dbUseODBC
    Set wrkODBCdirekt = CreateWorkspace(wrkName, wrkDefaultUser,
wrkDefaultPassw, wrkDefaultType)
    ' activate Batch-Update
    wrkODBCdirekt.DefaultCursorDriver = dbUseClientBatchCursor

    ' open connection
    Set conNorthwind = wrkODBCdirekt.OpenConnection("", , False,

    ' open recordset
    Set rstODBCPersonal = conNorthwind.OpenRecordset("Personal",
dbOpenDynaset, 0, dbOptimisticBatch)

    ' user-input (dummy)
    strFirstName = ""
    strLastName = ""
    strFirstName = Trim(InputBox("Vorname eingeben:"))
    strLastName = Trim(InputBox("Nachname eingeben:"))
    If strFirstName <> "" And strLastName <> "" Then

        For i = 1 To 3
            ' make NEW record in buffer

            ' values
            rstODBCPersonal("Vorname") = strFirstName & i
            rstODBCPersonal("Nachname") = strLastName & i

            ' save record ONLY in recordset

        Next i


        ' DB actualize in batch
        rstODBCPersonal.Update dbUpdateBatch


        ' Recordsets schliessen

        Debug.Print ("Insert some Text !!")
    End If

    ' close connection
    ' close workspace

    Debug.Print Err & ":  " & Error$
    For Each e In DBEngine.Errors
        Debug.Print e.Number & ":  " & e.Description
    Next e

End Sub


1. Actual ODBC error codes rather than 3146 -- ODBC Call failed


I'm using ODBC to query an Informix DB.

At any point if a get an error (wrong password, wrong DSN connect string,
wrong SQL statement..),
I get the same error code:

3146 -- ODBC Call failed.

Is there a way to get the right Informix status code/string ?

Note: I'm using ODBC; what about RDO/ADO/RDS...: is it faster ?


2. Corrupt index?

3. ODBC "3146 ODBC call failed"

4. multiple tables same ID in one

5. ODBC Call failed error 3146

6. Please help: Joining recordsets from different SQL databases in Crystal

7. LEFT JOIN - ODBC Call failed - Error 3146 - (#107)

8. voice capability in Oracle Forms 4.5

9. Error 3146 ODBC call failed

10. Error 3146 - ODBC Call Failed

11. Run-time error 3146, ODBC-call failed, like to know more

12. ODBC -- Call Failed Error 3146

13. error 3146, ODBC call failed