Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FolderExists across network times out causing FILE EXISTS ERROR

Status
Not open for further replies.

BJZeak

Programmer
May 3, 2008
230
CA
The following code is being used to generate folders across a local network. The application is running on a box that is hooked via wireless connection (54Mbs) to a 100M Wired network ... the box we are talking to has a shared folder ... both machines are running XP Pro SP3. The problem that has started to occur is FolderExists appears to be timing out intermittently which causes the code to believe the folder doesn't exist ... this in turn fires off the CreateFolder request which if the folder does exist generates the "FILE EXISTS" error.

Is there some other Metric that can be utilized to determine if a FileSystemObject request was completed properly?

Public Function MakeFolder(stFolder As String) As Boolean
On Error GoTo ErrMakeFolder
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")

MakeFolder = fs.FolderExists(stFolder)

If Not MakeFolder Then
MakeFolder = NOT (stFolder = fs.CreateFolder(stFolder))
EndIf

MakeFolder = True

Exit Function

ErrMakeFolder:

Call ErrMsg("MakeFolder " & Err.Description)
MakeFolder = False

End Function

 
Not tested, but something like:

Code:
Public Function MakeFolder(stFolder As String) As Boolean
On Error GoTo ErrMakeFolder

If Dir (stFolder, vbDirectory) <> "" Then
  MakeFolder = False
Else
  MakeFolder = True
End If

Exit Function

ErrMakeFolder:

Call ErrMsg("MakeFolder " & Err.Description)
MakeFolder = False

End Function

John
 
I have tried numerous ways including deleting the network drive and adding it back ... per the MSDN details on the filesystem object there are a number of methods and member values specific to methods but none appear to provide a positive feedback of the network drives health.

What I did today was turn off the wireless connection to this machine and run a wired connection to it to rule out issues with Radio Interference.

If this doens't work then I may have to build some API calls to test the network drive status and link them in to the Application.

 
You are very brave running an Access application over a wireless connection. It is a highly likely chance of corruption because of that. I hope that this is a split database (backend on server, and frontend on each user's machine), because if it isn't you are likely going to have corruption issues at some time here. It won't be a question of IF, but of WHEN.

Bob Larson
Free Access Tutorials and Samples:
 
I do have FE/BE apps running on Wired network PC's ... this app is only run on one machine but it needs access to a shared network drive for maintaining file backups ... this application has worked fine for almost 2 years ... it is only in this last year that the process has become intermittent. It could be due to radio interference and or equipment aging ... the machine runs 24/7 ... either way I should hopefully eliminate any issue with wireless now that this is wired. Should the issue still occur as stated I may have to write some code to test the network integrity.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top