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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

USe VBA to store a link to a picture?

Status
Not open for further replies.

superspeed

Programmer
May 2, 2001
19
0
0
US
I would like to use VBA within Access to set the link for a picture variable. I can do this manually but it woudl be helpful if the program can do it.

The manufacturers supply the pictures in the form of /directory/part number.jpg.

Does anyone know how to do this?

IA

 
Hi,
I have done this in the following manner. One field on the Access database has to hold the image name.
Or you could number your images in some way and have the VBA code generate the pathname.
You don't have to put the whole pathname if you put your images all in the same folder. I can provide you with more details if you e*mail me at kavjack@swbell.net. Another piece of advice convert all your .jpg images to bitmap .bmp. I found that .jpg images take too long to load as you scroll through the images and you get overrun problems. With .bmp you can scroll as fast as possible and the image loads instantly. You can live with .jpg images as long as you are patient enough to scroll very slowly through your database.
 
Set up a table that has two fields one is the part number the other is the path to the picture.

Create a form with a bound object frame and a list box. The data for the list box should come from your table (i.e. it will contain the available part numbers and the corresponding paths). You can set the column width of the "path" to zero so the user can't see it.

When the user fires the click event, change the SourceDoc Property of the bound object frame to the path of the part number.

Dim sPath as String

sPath = me.lstPartList.Column(i)

Me.OLEBound1.SourceDoc = sPath
Me.OLEBound1.Action = acOLECreateEmbed

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top