• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 717
  • Last Modified:

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

Hi:
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
0
Mohammad Alsolaiman
Asked:
Mohammad Alsolaiman
3 Solutions
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
afaik no, and even if you could, I would highly question whether you should.
0
 
Jeffrey CoachmanMIS LiasonCommented:
M_SOLAIMAN,

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

There might be a better way.

JeffCoachman
0
 
dannywarehamCommented:
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.
0
 
Jeffrey CoachmanMIS LiasonCommented:
M_SOLAIMAN,

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

Go here:
http://www.lebans.com/oletodisk.htm

Downoald the file named:
ExtractInventoryOLE.zip

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.

JeffCoachman
   
0
 
Mohammad Alsolaimanapplication programmerAuthor Commented:
thanks to all
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now