有没有办法获得 ms-access 以显示来自外部文件的图像 [英] Is there a way to get ms-access to display images from external files
问题描述
我有一个 MS-Access 应用程序(1/10 次 MS-Access,9/10 次 MS-SQL)需要显示一些资产的照片及其规格.目前,图像作为 OLE 对象存储在 MS-Access 表中(并由用户复制粘贴到字段中).
I've got an MS-Access app (1/10th MS-Acccess, 9/10ths MS-SQL) that needs to display photographs of some assets along with their specifications. Currently the images are stored in an MS-Access table as an OLE Object (and copy-n-pasted into the field by the users).
出于各种原因,我想做的是将原始.jpgs 存储在网络驱动器上的文件夹中,并从应用程序部分引用它们.我已经考虑过使用 MS-SQL 的图像数据类型(及其替代 varbinary),但我认为我的用户群会更容易掌握网络文件夹的概念.
For various reasons, I would like to do is store the original .jpgs in a folder on the network drive, and reference them from the application portion. I have considered moving into MS-SQL's image data type (and its replacement varbinary), but I think my user population will more easily grasp the concept of the network folder.
如何让 MS Access 显示 .jpg 的内容?
How can I get MS Access to display the contents of a .jpg?
推荐答案
另一种选择是在表单上放置一个图像控件.该控件(图片)有一个属性,它只是图像的路径.这是 VBA 中的一个简短示例,说明如何使用它.
Another option is to put an image control on your form. There is a property of that control (Picture) that is simply the path to the image. Here is a short example in VBA of how you might use it.
txtPhoto 将是一个文本框,绑定到带有图像路径的数据库字段imgPicture 是图片控件该示例是一个按钮的点击事件,该按钮将前进到下一条记录.
txtPhoto would be a text box bound to the database field with the path to the image imgPicture is the image control The example is a click event for a button that would advance to the next record.
Private Sub cmdNextClick()
DoCmd.GoToRecord , , acNext
txtPhoto.SetFocus
imgPicture.Picture = txtPhoto.Text
Exit Sub
End Sub
这篇关于有没有办法获得 ms-access 以显示来自外部文件的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!