Skip to content Skip to sidebar Skip to footer

Calling Stored Procedure From Ms Access Results In Error 3146

When I call a SQL Server stored procedure from MS Access front-end using the code shown below, it stops running and throws the runtime error '3146'. This stored procedure is workin

Solution 1:

If it runs, but not until the end, then it is probably not a permission problem, but a timeout problem

you can do a :

debug.print qdef.ODBCTimeout 

to know what your current Timeout value is.

Then just increase it with enough seconds to complete the stored procedure :

PublicSub Command0_Click()
    Dim qdef As DAO.QueryDef
    Set qdef = CurrentDb.CreateQueryDef("")

    qdef.Connect = CurrentDb.TableDefs("[ASBUILT_LIST]").Connect
    ' --------------- Define TimeOut in Seconds ----------------
    qdef.ODBCTimeout = 2000' ----------------------------------------------------------        
    qdef.SQL = "EXEC Update_Asbuilt2"
    qdef.ReturnsRecords = False''avoid 3065 error
    qdef.Execute
    qdef.Close

    Set qdef = NothingEndSub

Post a Comment for "Calling Stored Procedure From Ms Access Results In Error 3146"