I've inherited an old Access system that is maxed out on attachment fields in several tables. I am trying to use the routine for Access 2010 to extract the attached OLE Objects and save them to a file. All of the attachments are a single PDF
per database row.
The routine I am attempting to use is from the Microsoft Access 2010 example. The only changes being the function name to distinguish it from my other attempts, my table name, and my field name. The routing can be found here:
https://docs.microsoft.com/en-us/office/client-developer/access/desktop-database-reference/field2-savetofile-method-dao
I have pasted the beginning of it to the line where I get the error. What I get is "runtime error 424 Object required"
I'm no an Access or VBA guru so any help is greatly appreciated.
Public Function SaveAttachments711(strPath As String, Optional strPattern As String = "*.*") As Long
Dim dbs As DAO.Database
Dim rst As DAO.Recordset2
Dim rsA As DAO.Recordset2
Dim fld As DAO.Field2
Dim strFullPath As String
'Get the database, recordset, and attachment field
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("targets")
Set fld = rst("image")
'Navigate through the table
Do While Not rst.EOF
'Get the recordset for the Attachments field
Set rsA = fld.Value