Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2011
    Posts
    11

    Unanswered: ODBC Error 3146 on rs.update

    Hi,
    Using MS Access, I have a form that is based on a table called Motion_Imagery. In the VBA of this code I want to take two fields on the form and add the data in those two fields to the last record that was added to table Online_Books. When I run my code I get the error when it gets to rs.update, here is my code:


    Set db = CurrentDb()
    Set rs = db.OpenRecordset("dbo_Filestream_Files", dbOpenDynaset, dbSeeChanges)

    rs.MoveLast

    rs.Edit
    rs![Prefix_CTRL_NBR] = Me.Prefix_CTRL_NBR
    rs![CTRL_ID] = Me.CTRL_NBR
    rs.Update

    Can you tell me what the problem is? Is this possible to do?

    Thanks,
    Sharon

  2. #2
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    Sharon--

    Any luck on this yet? One thing you can try is to change from a dynaset recordset to a table recordset by using dbOpenTable as the second paramater in OpenRecordset. Just shooting in the dark.

    Also, careful about using MoveLast as that will move to the last record in the table but not necessarily the last record that was added. The best way would be to use some type of TimeStamp field and then query out the record with the latest TimeStamp.

    C

  3. #3
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    1. "dbo_Filestream_Files" obviously is an attached table linked to a SQL Server ("dbo_" prefix + optional parameter dbSeeChanges used to open the Recordset), so you cannot use the dbOpenTable parameter to open a recordset of type Table.

    2. Is the attached table updatable (when you open the table, can you change a value into a column)?

    3. Is the data type of the values in Me.Prefix_CTRL_NBR and Me.CTRL_NBR compatible with the data type and length of [Prefix_CTRL_NBR] and [CTRL_ID]?

    4. If Me.Prefix_CTRL_NBR or Me.CTRL_NBR is empty, does the corresponding column of "dbo_Filestream_Files" accept Null values?
    Have a nice day!

  4. #4
    Join Date
    Aug 2011
    Posts
    11

    going a different way

    Hi,
    Thanks for your help on this. I have decided to try something different.

    Sharon

  5. #5
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    I did nothing but you're welcome anyway!
    Have a nice day!

  6. #6
    Join Date
    Jun 2013
    Posts
    3

    meaningless "Error 3146: ODBC--call failed"

    I Googled "error 3146" and got this page as first result,
    so I propose here a link to a solution for meaningless generic message
    "Error 3146: ODBC--call failed":
    How To Get More Information on the ODBC Call Failed Error
    They propose to use a special error handler like this:

    ' DAO Error Handler
    Dim MyError As Error
    Debug.print Errors.Count
    For Each MyError In DBEngine.Errors
    With MyError
    MsgBox .Number & " " & .Description
    End With
    Next MyError

    I found it very usefull

Tags for this Thread

Posting Permissions

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