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)
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.
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?
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
For Each MyError In DBEngine.Errors
MsgBox .Number & " " & .Description