Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用MS Access VBA添加/查看对象_Vba_Ms Access_Createoleobject - Fatal编程技术网

使用MS Access VBA添加/查看对象

使用MS Access VBA添加/查看对象,vba,ms-access,createoleobject,Vba,Ms Access,Createoleobject,基于是否有一种方法可以以相同的方式进行操作,但这次是针对OLEObjects?我们如何替换AddAttachment方法?查看此参考以了解导入对象的方法。涉及到相当多的代码。下载示例数据库并开始审查此过程: Sub SaveFileToBlob(OLEPath, OLEName) Dim Tbl As New ADODB.Recordset Set Tbl = New ADODB.Recordset With Tbl .Open "TblEmbeddedObje

基于是否有一种方法可以以相同的方式进行操作,但这次是针对OLEObjects?我们如何替换
AddAttachment
方法?

查看此参考以了解导入对象的方法。涉及到相当多的代码。下载示例数据库并开始审查此过程:

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
使用AppendChunk和GetChunk方法。复习