我有一个带有ole对象字段的ms Access数据库,我在其中粘贴了从互联网上从各个地方收集的图像,在将它们复制到该字段之前没有创建文件
数据库已经很大,我想将图像导出到文件中并链接它们而不是嵌入它们
我已经走了
Public Function exportlink()
Dim strSQL As String
Dim mstream As ADODB.Stream
Dim strFullPath As String
Dim image As Control
Dim FN As String
Set image = Forms!frmuseful!image
strFullPath = "C:\Documents\pics\"
FN = Forms!frmuseful!ID & "a" & ".jpg"
'Create a Stream Object to contain the Binary Data from the OLE Object Field,
'(adTypeBinary), then Open it
Set mstream = New ADODB.Stream
mstream.Type = adTypeBinary
mstream.Open
'Write the contents of the OLE Object Field to the Stream
mstream.Write image.Value
mstream.SaveToFile strFullPath & FN, adSaveCreateOverWrite
End Function
输出一个文件,但是当我尝试打开它时,它说不是有效的JPG文件。在大小方面,它看起来更像我对位图文件的期望,但是更改为.bmp也不会提供有效的BMP文件。
我猜想我需要将流转换为jpg格式,但是我不确定该怎么做