• Add employee pictures to report

    Author
    Topic
    #460367

    I’ve read the posts on this, but I am sooo confused. I’m attaching my database and hope someone can take a look and tell me how to fix this. I am creating employee badges (3 x 5 labels) and need the employee’s name and picture to show. I have read so much about this, and it seems I need to insert a picture and delete the name. Then, I am supposed to add an on format event or code… and this is where I fall apart. I don’t know what method to use, and I have no idea how to modify code.

    Is anyone willing to take a look and tell me what I need to do?

    Thank you!

    Viewing 0 reply threads
    Author
    Replies
    • #1163883

      In the first place, you need to be consistent. Your report refers to field names that do not exist in the query (or table), and to controls that do not exist on the report.

      Assuming that you store the employees’ pictures in the same folder as the database, you should fill the PHOTOGRAPH_FILENAME field with the filenames only, without the path and without the extension .jpg. So for example, if an employee’s picture is named Jones.jpg, you should enter Jones in the PHOTOGRAPH_FILENAME field.

      In the attached zip file, I’ve added some pictures created from Microsoft’s sample employee pictures that came with Access 2002.

      Here is the code used for the report:

      Code:
      Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
        Dim strPath As String
        strPath = CurrentProject.Path & "" & Me.PHOTOGRAPH_FILENAME & ".JPG"
        If Dir(strPath) = "" Then
      	Me.Image6.Visible = False
        Else
      	Me.Image6.Visible = True
      	Me.Image6.Picture = strPath
        End If
      End Sub
      • #1163896

        Thank you, Hans. I started out being consistent! I promise! But, I got so confused with the code that I started renaming things. Anyway, it works now. Thank you so very much, once again.

    Viewing 0 reply threads
    Reply To: Add employee pictures to report

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: