Open Photographs in an Access Form

Anonymous
2023-01-26T23:26:10+00:00

I have a datatbase of photograph file names. In the DB I have a List Form that has a "Digital File Name" field. Question: Is it possable to create a command button on my List Form that will open the photo (that is stored in my Photos File on my C: drive) based on the digital file name for the selected record?

I am using Access 2016

Thanks Walt

Microsoft 365 and Office | Access | For home | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

49 answers

Sort by: Most helpful
  1. George Hepworth 23,120 Reputation points Volunteer Moderator
    2023-01-29T18:56:00+00:00

    Congratulations on solving the problem. Continued success with the project.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2023-01-29T18:49:44+00:00

    My bad!!! It did work after I selected the correct image. Thank you, thank you for your help 🤠

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2023-01-29T18:46:34+00:00

    Thanks for your help - I need all I can get. I first made sure that the field name had no spaces "DigitalFileName". I then changed the code to "

    Private Sub OpenImageBtn_DblClick(Cancel As Integer)

    Application.FollowHyperlink "D:\Documents\Family Tree Maker\Wright-Jagoe(1) Media\" & Me.DigitalFileName 
    

    End Sub

    Saved everything and dbl clicked the command button and got this error message on the code builder page:

    Run-time error '490':

    Cannot open the specified file.

    Somethings wrong!

    Was this answer helpful?

    0 comments No comments
  4. George Hepworth 23,120 Reputation points Volunteer Moderator
    2023-01-29T18:09:06+00:00

    In your code, "OpenImageBtn" refers only to the command button which you click. Instead, use the field in the table which actually contains the name of the actual image itself. It appears from your question that that field is named: "Digital File Name". Bind that field to a text box control on the form and change the reference in your code to that field.

    By the way, we generally recommend field names should have no spaces in them. It should be "DigitalFileName", not "Digital File Name". It is a minor issue that can have major impact on your frustration level.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2023-01-29T17:44:36+00:00

    Scott,

    Yes I tried your suggestions but was unable to get either one to work. It's probably that I'm not expert enough with Access to fully understand. I understand the events and put them in using event builder in the command box double click. I can't figure out how to bind the command button to the image field in my form as the command button data tab doesn't have a field option. Below is how I entered the event for an image entry using the full path in the inage field of my form:

    Private Sub OpenImageBtn_DblClick(Cancel As Integer)

       Application.FollowHyperlink Me.OpenImageBtn 
    

    End Sub

    I also tried with only the file name entered in the image field:

    Private Sub OpenImageBtn_DblClick(Cancel As Integer)

       Application.FollowHyperlink "D:\Documents\Family Tree Maker\Wright-Jagoe(1) Media\" & Me.OpenImageBtn 
    

    End Sub

    Not sure what I'm missing or doing wrong.

    Walt

    Was this answer helpful?

    0 comments No comments