本文介绍了将照片添加到表单/报告中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读论坛,但我真的需要一步一步。我大约3年前参加了一天的vb课程,所以我知道这一点很困惑!


我有一个学生数据库,我必须添加照片。在Access 2000中,我使用OLE字段类型添加了它们。即使在安装Photo Editor之后,我似乎无法让Access 2003执行此操作。在我的阅读中,似乎使用文本类型并使用路径或使用BLOB是更好的解决方案。我似乎无法搞清楚。


我很感激有人带我走过这些台阶。


我有一张桌子图像(虽然我还没有导入它们)名为tblStudentPhoto,有两个字段,studentstateID和Photo。我将照片字段作为OLE,但将其更改为文本。我应该输入这个字段的路径吗?如果是这样,我是否从驱动器号开始?

解决方案




虽然不是最有效的方法,但对于具有有限VBA技能的新手来说,最简单的方法是将实际的照片图像动态加载到表单上的图像控件中在运行时。这将不需要存储OLE对象,并且几乎没有开销。唯一的要求是将照片的名称存储在文本字段中,例如:BartSimpson.jpg,209768871.jpg等。代码将处理其余部分,照片将保留在数据库的外部。



将照片添加到图像控件的代码是什么?


I have been reading the forums, but I really need a step by step. I took a one day vb class about 3 years ago, so I know just enough to be confused!

I have a database of students that I have to add photos to. In Access 2000, I had added them using the OLE field type. I can''t seem to get Access 2003 to do this, even after installing Photo Editor. In my reading, it appears that using a text type and using a path or using BLOBs are better solutions. I can''t seem to figure out either.

I would appreciate someone walking me through the steps.

I have a table for the images (though I have not imported them yet) named tblStudentPhoto with two fields, studentstateID and Photo. I had the photo field as an OLE but changed it to text. Should I type the path into this field? If so, do I start with the drive letter?

解决方案


Although not the most efficient Method, the simplest especially for a Newbie with limited VBA skills, would be to dynamically load the actual Photo Image into an Image Control on a Form at run time. This would require no storage of OLE Objects, and virtually no overhead. The only requirement would be to store the name of the Photo in a Text Field such as: BartSimpson.jpg, 209768871.jpg, etc. The code will take care of the rest and the Photos would remain external to the DB.



What would be the code to add the photo to the image control?


这篇关于将照片添加到表单/报告中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 06:25