Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

Access unexpected error 53: File not found

I have the following code in an onclick event of a label on a form but once in a while the user gets this message:

Access unexpected error 53: File not found

and the user is not directed to the server folder.

Does anyone know what this is all about and perhaps have a solution?


Private Sub Label241_Click()

    'Copied over from frmPartsMasters
    Dim stAppName As String

    On Error GoTo errhand

    stAppName = "C:Windows\explorer.exe \\D5XR1BP1\Company\General Shared Files\PRINTS\" & Me.txtPartN & "\"
    Dim d As Double
    Dim dty As String
    dty = "\\D5XR1BP1\Company\General Shared Files\PRINTS\" & Me.txtPartN
    If Len(Dir("\\D5XR1BP1\Company\General Shared Files\PRINTS\" & Me.txtPartN & "\")) = 0 Then
        MkDir ("\\D5XR1BP1\Company\General Shared Files\PRINTS\" & Me.txtPartN)
        MsgBox "Folder has been created on server.  Remember to place image files in this folder."
    End If

    Call Shell(stAppName, 1)
   
    Exit Sub
errhand:
    If Err.Number = 75 Then
    ' probably directory exists but empty
    ' ignore
    Resume Next
Else
    MsgBox "Unexpected error " & Err.Number & " : " & Err.Description
    Resume Next
End If

Exit_cmdExplore_Click:
    Exit Sub

Err_cmdExplore_Click:
    MsgBox Err.Description
    Resume Exit_cmdExplore_Click

End Sub
ASKER CERTIFIED SOLUTION
Avatar of dec0mpile
dec0mpile
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aikimark
Since you have a space in the path name, you need to surround the path with quote characters.  You can do that with a quote character literal in the string (doubled, of course) or concatenate a couple of Chr(34) values into the string.