Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2002

    Question Unanswered: opening a picture file with Access

    I have made some code that finds all the pictures in a certain directory associated with the current order being displayed and it works fine EXCEPT that it opens the last image file twice. Below is the code:

    Set Button = Me!cmdPic

    strJob = me!OrderJobNo
    strLook = the path to my pictures

    With Application.FileSearch

    .LookIn = strLook
    .FileName = strJob & "*.jpg"

    If .Execute > 0 Then

    For intCounter = 1 To .FoundFiles.count

    strSearch = .FoundFiles.Item(intCounter)

    With Button

    .HyperlinkAddress = strSearch

    End With

    Next intCounter


    MsgBox "Sorry, a picture of this Job was not found."

    End If

    End With

    I have had to use the hyperlinkaddress property of the command button that the user pushes to open the files because I do not know what reference and what commands in that reference that I would have to use to open a .jpg file. It doesn't matter how many pics that there are of a job, it always opens the last one found twice. While this seems like a minor inconvenience it is annoying to me and I also wouldn't mind learning how to open image files in Access. Thank you in advance for your time and responses.

  2. #2
    Join Date
    Aug 2004
    Try looking at this tread

  3. #3
    Join Date
    Nov 2002

    Cool Thanks for the reply but...

    The pictures that are being opened are larger in size than the form itself, and there are already too many controls for my liking on the form in question. I am also not looking to make the users find the images themselves but rather want it done for them, automatically. My code works quite well but just opens the last image file found twice. There can, btw, be anywhere from one to six images per job, so an unbound image frame won't work. I was actually wondering if anyone knew of a reference to add that allowed image application opening rather than following a hyperlink, or rather someone could find some logic error or something in my code that causes the last image file found to be opened twice. Thank you all for your time and responses in advance.

  4. #4
    Join Date
    Feb 2005

    opening picture files with access

    Are these pictures stored in a directory or a table? If they are in a table, you can use a recordset to open them and use the recordset's .BOF and .EOF (beginning of file and end of file) properties in a Do Until loop. Just a suggestion, hope it works for you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts