Can I declear a variable in VBA as an OLE object.

Can I declear a variable in vba as an ole object.
Because I have I picture in a table, and I need to move this picture from the table to this variable
Mohammad Alsolaimanapplication programmerAsked:
Who is Participating?
dannywarehamConnect With a Mentor Commented:
A variable can only hold certain types of data (strings, numbers etc).
An OLE object is both an embedded/linked object AND the application wrapper associated with it.

For example, your image (.bmp) is actually an image file wrapped in the MS Paint application.

Access doesn't store images well and having them in your system will cause bloating.

You can either look into using Binary Long Objects (BLOBS) or, my prefered method, store the image in a shared network area and store the text hyperlink address for that image in your table.
Then you can use a simple piece of code to pull the image into a frame/image object on your form.
Jim HornConnect With a Mentor Microsoft SQL Server Developer, Architect, and AuthorCommented:
afaik no, and even if you could, I would highly question whether you should.
Jeffrey CoachmanMIS LiasonCommented:

As you know, it is always helpful if you explain *why* you need to do this.

There might be a better way.

Jeffrey CoachmanConnect With a Mentor MIS LiasonCommented:

Now you see why most Access Developer do not store images in the Access database.

Go here:

Downoald the file named:

Extract the files to a folder.

Open the DB
Open the form called: ExtractInventoryAllOLEobjectsFromTable

This will convert each Object in the OLE field to it's respective file type.

Mohammad Alsolaimanapplication programmerAuthor Commented:
thanks to all
All Courses

From novice to tech pro — start learning today.