A family of Microsoft relational database management systems designed for ease of use.
Congratulations on solving the problem. Continued success with the project.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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
A family of Microsoft relational database management systems designed for ease of use.
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.
Congratulations on solving the problem. Continued success with the project.
My bad!!! It did work after I selected the correct image. Thank you, thank you for your help 🤠
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!
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.
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