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

Showing and image file

Status
Not open for further replies.

MuskyMan

Technical User
Jul 31, 2002
36
0
0
US
Each record has a coresponding image file. I've linked the Object to the record using the wizard without any problems, however, I need to double-clik to show the object (either a JPG or a DWG file). Is there a way that the object opens automatically without having to double-click?

Thanks, could not find a solution in the FAQ section..

 
Create a field in your table called imagepath.
For each record, enter the imagepath (i.e. C:\myimage.jpeg) to its corresponding image.

Place an unbound image box on your form.
Make sure the form's recordsource is set to your
table with the imagepath field.

In the form's On Current event place this code:

Private Sub Form_Current()

Dim path

path = Me!ImagePath.Value

YourImage.Picture = path

End Sub

Hope this helps you.
 
Hey cghoga, thanks! The code worked like I had hoped. I could not open up my CAD (dwg) file but luckly I can convert these to a BMP.

Thanks again..

 
This bit of code has helped me alot.

Now I want to expand on this.

Say for example I have my records, I scroll through them and the photo's appear.

I introduce some more photos in the folder I am calling them from, but in the text field I spell the name wrong.

Instead of Access coming to an abrupt halt and asking me to debug, I'd like a message box to appear stating that the photo does not exist. Move to the next record Yes/No.

 
Take a look at the On Error instruction.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
ARRGGHHHH

Just upgraded to Access 2003 and this code doesn't work.
Not even when the default is set to 2000
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top