Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2008-10-07
5
593 Views
Last Modified: 2013-11-27
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
Comment
Question by:Mohammad Alsolaiman
5 Comments
 
LVL 65

Assisted Solution

by:Jim Horn
Jim Horn earned 100 total points
ID: 22662348
afaik no, and even if you could, I would highly question whether you should.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 22692098
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
 
LVL 26

Accepted Solution

by:
dannywareham earned 250 total points
ID: 22698226
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
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 150 total points
ID: 22698797
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
 

Author Closing Comment

by:Mohammad Alsolaiman
ID: 31503839
thanks to all
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question