有没有办法让ms访问从外部文件显示图像 [英] Is there a way to get ms-access to display images from external files

查看:98
本文介绍了有没有办法让ms访问从外部文件显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MS-Access应用程序(1/10 MS-Acccess,9 / 10ths 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访问从外部文件显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆