A family of Microsoft relational database management systems designed for ease of use.
I think I got it. Take out line 2 from both strFile1 and strFile2.
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.
I think I got it. Take out line 2 from both strFile1 and strFile2.
I use this and there is still something wrong. Help!
Private Sub OpenImageBtn_DblClick(Cancel As Integer)
StrFile1 = "D:\Documents\Family Tree Maker\Wright-Jagoe Media\" & Me.DigitalFileName1
strFile2 = "D:\Documents\Family Tree Maker\Laidlaw-Fowler Media\" & Me.DigitalFileName2
If Dir(StrFile1) = "" Or Dir(strFile2) = "" Then
End Sub
Walt
You still have to use the rest of the code in the IF statement.
The three lines I suggested were to replace the just the three lines in the rest of your code.
Scott, I am really confused being less than a beginner with code. I'm not sure which "three lines" are the ones you suggested.
Could you please show me how the code should look?
Scott, I am really confused being less than a beginner with code. I'm not sure which "three lines" are the ones you suggested.
Could you please show me how the code should look?
OK, this was the original code I suggested:
Private Sub OpenImageBtn_DblClick(Cancel As Integer)
Dim strFile as String
strFile = "D:\Documents\Family Tree Maker\Wright-Jagoe(1) Media" & Me.DigitFileName
If DIR(strFile) = "" Then
MsgBox "File does not exist!"
Else
Application.FollowHyperlink strFile
End If
End Sub
You then said that you had photos in 2 folders and asked how to deal with it. So I posted just the lines that needed to be changed.
strFile1 = "D:\Documents\Family Tree Maker\Wright-Jagoe(1) Media" & Me.DigitFileName1
strFile2 = "D:\Documents\Family Tree Maker\Wright-Jagoe(1) Media" & Me.DigitFileName2
If DIR(strFile1) = "" OR DIR(strFile2) = "" Then
You have to use the whole code not just the modified lines.