I have the following problem:
In ms access I have a button to open a file or folder on my computer.
If I want another user to be able to open the same folder from his computer, if using the same button of course he gets an error. He needs to take another path. So I created a second button. Effective, but not very handy .
I want to be able to Follow one path in my code and on error, close windows explorer and try another path.
Till now I wrote the following (but it still opens 2 windows. One correct, and one fault).
Thanks for helping me out (I hope I explained my problem correctly)
In ms access I have a button to open a file or folder on my computer.
If I want another user to be able to open the same folder from his computer, if using the same button of course he gets an error. He needs to take another path. So I created a second button. Effective, but not very handy .
I want to be able to Follow one path in my code and on error, close windows explorer and try another path.
Till now I wrote the following (but it still opens 2 windows. One correct, and one fault).
Code:
Private Sub Knop299_Click()
'opening a folder by following a path
'when the path does not exist, try the following path e.g. path2
' and so on
Dim Foldername As String
Dim Foldername2 As String
Foldername = "D:\Documents and Settings\Administrator\Mydocuments\doc27"
Foldername2 = "F:\BEHEER\BELANRIJKEDOCUMENTEN\doc27"
Shell "C:\Windows\explorer.exe """ & Foldername & "", vbNormalFocus
'here it goes wrong. File is not on this path, but still my documents is opened
'so here I would like a code to close explorer.
On Error Resume Next
Shell "C:\Windows\explorer.exe """ & Foldername2 & "", vbNormalFocus
End Sub
Thanks for helping me out (I hope I explained my problem correctly)