连续窗体中显示每条记录的图片,在以前的版本中,是要依靠绑定控件和BMP图片来实现的.在2007版本中新增加了Attachment(附件)字段.有效地解决了这一问题.
将attachment字段拖到窗体上,就可以了.
利用VBA添加附件文件:
附件也要申明为DAO.Recordset类型
例: 员工表tblEmployee中包含员工照片字段(附件类型) EmployeePicture.
dim rstEmployee as dao.recordset
dim rstPictures as dao.recordset
set rstEmployee=CurrentDb.openrecordset("tblEmplyee",dbopendynaset)
........
rstemployee.edit
set rstPictures=rstemployee.fields("EmployeePicture).value
rstpictures.add
rstpictures.fields("FileData").loadfromfile="图片完整路径名"
rstpictures.update
rstemployee.update