photo display

peterbowles

Registered User.
Local time
Today, 18:26
Joined
Oct 11, 2002
Messages
163
Hi all


I have a table that stores information about students. I have a photo for each of them and I want to be able to display this photo on several forms in the database. All the photos are stored in a special folder on my computer called “photos”

What is the best way to do this

Thanks it advance
 
Peter

How to include a bound picture on form:

While it's possible to actually store the images within the database itself as OLE objects, normally it's not the preferred way. When you embed an OLE object in a table, you're storing a lot of overhead as well. This overhead is the information about the object (such as it's parent application) that Access needs to store in order to render the object properly.

The preferred way to display images is to store the complete path and filename to the actual files themselves within a table, and then use the Image tool (in Access 97/2000) to update the display.

The following example shows you how to display Windows bitmap images on a Microsoft Access form without storing the images in a Microsoft Access table.

Creating the Table to Store File and Path Data:

  1. Create a new table that is named Imagetable and then add a text field that is named ImagePath.
  2. Open the Imagetable table in Datasheet view and then add the path and the name of a bitmap file to each record. The following examples show how the records might look:
    [/list=1]
    c:\windows\circles.bmp
    c:\windows\waves.bmp
    c:\windows\tiles.bmp
    c:\windows\bubbles.bmp

    Displaying Images in a Form
    1. Use the AutoForm: Columnar Wizard to create a new form that is based on the ImageTable table.
    2. Open the Imageform form in Design view and then add an image control to the form by using the Image tool in the toolbox. You are prompted to select an image to insert. Select any image available on your computer. Name the control ImageFrame.
    3. Set the OnCurrent property of the Imageform form to the following event procedure:

      Code:
            Private Sub Form_Current()
               On Error Resume Next
               Me![ImageFrame].Picture = Me![ImagePath]
            End Sub
    4. Set the AfterUpdate property of the ImagePath text box to the following event procedure:

      Code:
            Private Sub ImagePath_AfterUpdate()
               On Error Resume Next
               Me![ImageFrame].Picture = Me![ImagePath]
            End Sub
    5. Open the Imageform form in Form view. Notice that the form displays the corresponding bitmap for each record.
      [/list=1]

      Note: You may need to amend the file paths and image names to correspond with images stored on your system.

      HTH

      Graham
 

Users who are viewing this thread

Back
Top Bottom