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!

How to Load a picture in Access form

Status
Not open for further replies.

acct98

IS-IT--Management
Aug 15, 2002
194
0
0
US
Has anyone tried this? I was not able to get it to work.
faq181-279

What this does...
It loads a picture ie .jpg or .gif or .bmp into an Image control on the form. So as you navigate through the records it automatically loads a picture from the hard drive.
Note: It might be slow if the picture is large or you have a slow machine. A Pentium II or better should be fine.
Benefits: Can have thousands/10's of thousands of pictures and does not Bloat database. Becasue no pictures are inside the database they are left on the hard drive.

Steps:
1. Add an "Image" control to the form.
Follow the prompts and load a picture of the type you will be using.
2. Open the properties of the image and remove the picture.
3. Put this code in the forms On_current event
---------------------------------------
Private Sub Form_Current()
If Me![ID] <> 0 Then
Me!Image14.Picture = &quot;p:\ViewPhotos\Photos\&quot; & Me![ID] & &quot;.jpg&quot;
Label20.Caption = &quot;File: &quot; & &quot; p:\ViewPhotos\Photos\&quot; & Me![ID] & &quot;.jpg&quot;
End If
End Sub
----------------------------------
The Label20 simply shows the path of the picture for troubleshooting purposes.

 
Use the example in the Northwind database as a reference. This does exactly what you are describing. The example is on the &quot;employee: form. Go to design view and you will see the hidden text box which contains the path for the picture on the hard drive to ther image control.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top