0

Based on Add/view attachments using MS Access VBA is there a way to act the same way but this time for OLEObjects? How can we replace the AddAttachment method?

Community
  • 1
  • 1
Metal
  • 1
  • 4

1 Answers1

0

Review this reference for method to import OLEObject Import OLEObject. Quite a bit of code involved. Download the sample db and start with review of this proc:

Sub SaveFileToBlob(OLEPath, OLEName)
Dim Tbl As New ADODB.Recordset

    Set Tbl = New ADODB.Recordset
    With Tbl
        .Open "TblEmbeddedObjects", MasterDbConn, adOpenKeyset, adLockOptimistic, adCmdTable
        .AddNew
        .Fields("fldDocumentName").Value = OLEName
         FileToBlob OLEPath & OLEName, .Fields("fldDocument")
        .Fields("fldDocumentDate") = Date
        .Fields("fldDestinationPath") = Replace(OLEPath, "\\", "\")
        .Update
        .Close
    End With
    Set Tbl = Nothing

End Sub

Uses methods AppendChunk and GetChunk. Review Manage OLEObject

June7
  • 19,874
  • 8
  • 24
  • 34