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 = "p:\ViewPhotos\Photos\" & Me![ID] & ".jpg"
Label20.Caption = "File: " & " p:\ViewPhotos\Photos\" & Me![ID] & ".jpg"
End If
End Sub
----------------------------------
The Label20 simply shows the path of the picture for troubleshooting purposes.
Now in my example the picture name was the same as the ID on the form. So when ID 23454 was showing on the form, it loaded 23454.jpg into the image.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.