Hi

I am hoping that someone can help me with an issue I am facing. I am trying to create code that will open a file when the file is present and if the file is not present for any reason a message box appears to inform the user to contact a team. I have tried various ways to get the code to function properly but on each occasion only one of the two options functions so for example the file opens if present but the message box doesnt open if not available.

The code I have at the moment is below, where attach1 is a hidden text box that holds the file pathname:

Private Sub Command13_Click()
Dim sFile As String
sFile = "Me.attach1"
If Dir(sFile) <> "" Then
        Call OpenDocument(Me.attach1)  ' Me.Attach1 holds the file pathname
Else
        MsgBox "The file is not available - Please Speak to the Technical Team"
End If
End Sub
Im sure the solution will likely be obvious but unfortunately I am far from being an expert with vba coding.

Any help with this would be really appreciated.

Many thanks

Sam