Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically Populating an OLE object field

Status
Not open for further replies.

jpegbert

Technical User
Jul 24, 2001
6
US
I need to populate an OLE field with jpg objects. All of the jpgs are in one folder and the names of the jpgs correspond to the data in my key field. I tried entering the path and filename into the filed and then changing the field type to OLE but that didnt seem to work. Anyone know of a way to do this? Ottherwise I will have to manually link over a thousand jpgs. Thnaks
 
Try putting an image box on your form, then put the following into your form's on current event:

Dim strDirectory As String, strImageName
strDirectory = "c:\My Documents\My Images\" 'change this to the location where your jpeg's are kept
strImageName = Me!txtTextBox 'change this to the name of your key field

Me!imgImage.Picture = strDirectory & strImageName & ".jpg" 'change Me!imgImage to the & _
name of your image box and change .jpg to .jpeg if necessary

In the properties window set the Picture Type to Linked.

Each time you move to a new record, as long as the key field you mentioned is the correct name of the file, it should load instantly. Unfortuneately, Access temporarily displays a message that you're importing an image. Maybe someone else knows how to turn this off, otherwise as far as I know, Access doesn't display this message if it's linking to a .bmp image.

Let me know if this is not what you want. If you want to actually store them in your database, that's a different matter, with a thousand images, even in jpeg format, the database will be massive. Someone else correct me if I'm wrong, Access e.g. if a jpeg file size is 50kb, the Access database would grow more than 250kb or more.

Bill
 
Hello,

I've tried to follow the code in Bill's post, but I'm receiving a "method not found" message that gets hung up at the [OLEFile].Class line.

Did this happen to you?


-Patrick

Nine times out of ten, the simplest solution is the best one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top