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

Display image in form from filename 1

Status
Not open for further replies.

johnnygeo

Programmer
Apr 23, 2003
125
US
I have an Access 2000 db which generates an html output file. Rather than store my images as OLE objects, I am storing the path to the image files as text.

I have a form for maintaining the data, and I would like to display the images on the form. How do I get from a filename as text to an image?

i.e., I have a control txtFileName = "c:\myPath\myImage.gif"
I want a control next to it to display the image itself.

thanks,
Johnny Geo
 
Insert an image control on your form and in the OnCurrent event of the form, set the Picture property of the image control equal to the value of txtFileName.

imgYourImageControlName.Picture = txtFileName

Note that an image does not display animation (as a gif might imply). If your gif files are animated, then you might want insert the Microsoft Web Browser ActiveX control or use gif89.dll (search tek-tips for its location for downloading).
 
Thanks, FancyPrairie, that worked fine for what I described.

Unfortunately, I neglected to mention that my form is continuous, and using the onCurrent event makes all the images change to the same thing. I think I need somehow to bind the image control to the field behind the txtFileName control. Is there a way to do this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top