fingerman
fingerman

Reputation: 2470

Unbound OLE object controller - Change picture via VBA - Microsoft Office Access

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.

Upvotes: 1

Views: 6762

Answers (1)

HansUp
HansUp

Reputation: 97101

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.

Upvotes: 2

Related Questions