Greetings all,
I'm working with some existing code that use getAttr() on a specifed file located on the same network on a different server to check if a file exists.
The results of which are then checked to ensure the errorcode isn't 0 and then a further check is done to ensure it's a file and not a directory, if its a file then the function returns true exists it return false.
This same application has been deployed to different people, unlike the others, one person has a 50/50 failure rate with the function returning false at the end of five retry attemps with a 1 second delay between retrying.
The error code isn't recorded in the application log, the filename is and it's a valid filename and not a directory.
Can anyone think if there are other ways to check if the file exists that have advantages over getattr().
Also due to the same application not have this issue, does anyone have any code ideas how I can investigate if it is network related?
I imagine it will return error code 53 every time, file not found.
Thanks
Rob
I'm working with some existing code that use getAttr() on a specifed file located on the same network on a different server to check if a file exists.
The results of which are then checked to ensure the errorcode isn't 0 and then a further check is done to ensure it's a file and not a directory, if its a file then the function returns true exists it return false.
This same application has been deployed to different people, unlike the others, one person has a 50/50 failure rate with the function returning false at the end of five retry attemps with a 1 second delay between retrying.
The error code isn't recorded in the application log, the filename is and it's a valid filename and not a directory.
Can anyone think if there are other ways to check if the file exists that have advantages over getattr().
Also due to the same application not have this issue, does anyone have any code ideas how I can investigate if it is network related?
Code:
FileExists = False
Attr = GetAttr("C:\Database41.mdb")
MsgBox ("Attr has value of " & CInt(Attr))
If Err = 0 Then
If (Attr And vbDirectory) = vbDirectory Then
FileExists = False
MsgBox "File doesn't exist"
Else
FileExists = True
MsgBox "File Exists!"
End If
End If
Thanks
Rob