未绑定的 OLE 对象控制器 - 通过 VBA 更改图片 - Microsoft Office Access
我有一个表,在该表中我有这样的用户:
id username name password picture
现在,我有一个表单,在该表单中我希望能够在未绑定 Ole 对象中显示图片。我的情况需要使用未绑定的对象,所以不要告诉我有关绑定的解决方案。
好的,现在我需要在发生某些情况时更改此值 - 我可以使用 DLookup() 从表中获取图片,但我不知道如何使用 VBA 将值放入控制器中......什么属性我用吗?
谢谢, 手指曼。
I have a table, in that table I have users something like this:
id username name password picture
now, I have a form, in that form I want to be able to show the picture in an unbound Ole object. My situation requires use of an unbound object, so don't tell me about bound solutions.
Ok, now I need to change the value of this as something happens - I can get the picture from my table using DLookup(), But I don't know how to put the value in the controller with VBA.... what property do I use?
Thanks,
Fingerman.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我怀疑你想做的事情是不可能的。每次尝试更改未绑定的 OLE 控件的值都会引发错误 2774,“该组件不支持自动化”。所以我最好的猜测是,如果您想使用自动化,它必须是一个绑定控件。我能想到的唯一的其他可能性是在设计模式下重新打开表单(使用VBA);也许你可以找到一些方法来改变它。
不过,我以前从未尝试过这样做。在窗体上显示图像时,我使用图像控件而不是 OLE 控件。据微软称,图像控件对图像的运行速度更快。
另外,我不将实际图像存储在表中。相反,我将图像的路径存储在文件系统中。通过 VBA 可以轻松地将外部图像分配给图像控件。在 Access 2007 之前,在数据库中存储图像的效率是出了名的低。据说从2007年开始,有一种更新的方法可用,效率较低,但我仍然不使用它。
I suspect what you want to do is not possible. Every attempt to alter the value of an unbound OLE control throws error 2774, "The component doesn't support Automation." So my best guess is it must be a bound control if you want to use automation with it. The only other possibility I can think of is to re-open the form in design mode (with VBA); perhaps then you could find some way to alter it.
However, I've never attempted this before. When displaying an image on a form, I use an Image control rather than an OLE control. According to Microsoft, the Image control operates faster for images.
Additionally I don't store the actual image in a table. Instead, I store the path to an image in the file system. It's easy to assign that external image to the image control from VBA. Prior to Access 2007, storing images in the database was notoriously inefficient. Supposedly, starting with 2007, there is a newer method available which is less inefficient, but I still don't use it.