VBA Access 2007中有等效的代码吗? [英] is there equivalent code in VBA Access 2007?
本文介绍了VBA Access 2007中有等效的代码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这似乎是.NET Framework代码. ByteImage = System.IO.File.ReadAllBytes("C:\ my folder \ my file")
This appears to be .NET framework code. ByteImage = System.IO.File.ReadAllBytes("C:\my folder\my file")
由于我没有使用.NET,所以VBA(Access 2007)中是否有等效的代码可以执行相同的操作?
Since I am not using .NET, is there equivalent code in VBA (Access 2007) that will do the same thing?
推荐答案
也许:
''Reference: Microsoft ActiveX Data Objects x.x Library
Set mstream = New ADODB.Stream
mstream.Type = adTypeBinary
mstream.Open
mstream.LoadFromFile "c:\docs\image.jpg" 'FileNameToLoadWithFullPath
您可以像这样轻松地将其添加到记录集:
You can easily add this to a recordset like so:
rs.AddNew
rs.Fields("ImageCol").Value = mstream.Read
rs.Update
这篇关于VBA Access 2007中有等效的代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文