Hi,
Posted a short thread the other day with regards picking up an error message if the file length was null. I've managed to get halfway there but am still having some issues and was hoping someone could help. Here's the code I'm runing off a button in a form:
Private Sub ViewLogImage_Click()
Dim WellPath
WellPath = Dir("W:\Open\" & "*" & Me.Name.Value & "*", vbDirectory)
Dim ProjPath
ProjPath = "W:\Open\" & WellPath & "\" & Name & ".TIF"
If Len(WellPath) = 0 Then
MsgBox "No Image Available for " & Me.Name.Value
Else
Shell "C:\Program Files\Mozilla Firefox\firefox.exe """ & ProjPath & "", vbNormalFocus
End If
End Sub
All is fine except that ideally I'd like the MsgBox to pop up if the ProjPath is null. When I substitute the If Len(WellPath) with If Len(ProjPath) the If Else doesn't work. At the moment it's only working if the folder (WellPath) doesn't exist. However if the folder exists and the file doesn't Firefox opens with a file not foud error. Obviously I'd like to skip this and let the user know the file doesn't exist without Firefox opening with an error.
Any ideas would really be appreciated, I'm slowly going insane
. Does Len only work with Dir?
Thanks
Gareth
Posted a short thread the other day with regards picking up an error message if the file length was null. I've managed to get halfway there but am still having some issues and was hoping someone could help. Here's the code I'm runing off a button in a form:
Private Sub ViewLogImage_Click()
Dim WellPath
WellPath = Dir("W:\Open\" & "*" & Me.Name.Value & "*", vbDirectory)
Dim ProjPath
ProjPath = "W:\Open\" & WellPath & "\" & Name & ".TIF"
If Len(WellPath) = 0 Then
MsgBox "No Image Available for " & Me.Name.Value
Else
Shell "C:\Program Files\Mozilla Firefox\firefox.exe """ & ProjPath & "", vbNormalFocus
End If
End Sub
All is fine except that ideally I'd like the MsgBox to pop up if the ProjPath is null. When I substitute the If Len(WellPath) with If Len(ProjPath) the If Else doesn't work. At the moment it's only working if the folder (WellPath) doesn't exist. However if the folder exists and the file doesn't Firefox opens with a file not foud error. Obviously I'd like to skip this and let the user know the file doesn't exist without Firefox opening with an error.
Any ideas would really be appreciated, I'm slowly going insane

Thanks
Gareth