简体   繁体   中英

Add/View OLEObjects using MS Access VBA

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM