ODBC Connect Error 3146

  • Hi,

     

    New to SQL and this forum, so forgive me if this is a bit of a basic question.

    I have an Access app that back ends to SQLExpress. One table is giving probs when I am populating it with data from an accounts system.  The .Update on the DAO Recordset reports error 3146 - ODBC--call failed.

    Code:

                        stSql = "SELECT * FROM accStockLoc " & _

                                "WHERE [MCMCode] ='" & stMCMCode & "' " & _

                                "AND [LocStkCode] = '" & Trim(.stCode) & "' " & _

                                "AND [LocLocCode] = '" & Trim(.stLocationList.slLocationCode) & "'"

                        Set rsStockLoc = CurrentDb.OpenRecordset(stSql, dbOpenDynaset, dbSeeChanges)

                        If Not rsStockLoc.EOF And Not rsStockLoc.BOF Then

                       

                            rsStockLoc.New

                        Else

                            rsStockLoc.Edit                    End If

                       

                        rsStockLoc!MCMCode = stMCMCode

                        rsStockLoc!LocStkCode = Trim(.stCode)

                        rsStockLoc!LocLocCode = Trim(.stLocationList.slLocationCode)

                        rsStockLoc!LocStkQtyStock = .stLocationList.slQtyInStock

                        rsStockLoc!LocCurrent = True

                       

                        rsStockLoc.Update

    Any help appreciated

     

    Dave

     

     

  • Pls ignore this post - I have seen the error of my ways (.Edit and .New in wrong parts of If Statement)

     

    Thanks anyway!

     

    Dave

     

     

     

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply