Inconsistent failure - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Inconsistent failure

My VB skills are rusty, so please excuse the lack of efficient code. I've attached the full script, and 3 sample files. My issue is running this code I will randomly get errors that should not be able to occur. For instance look at this following code section:

[code]Try
vTarget = fsoObj.GetFile("I:UsersJaridClientNameWithheldClientNameWithheld_ETLstaging emp_ci.csv")
If fsoObj.FileExists(vTarget) Then
vTarget.Delete()
End If
Catch
End Try

vFile.Name = "temp_ci.csv"
[/code]

The program will run through 5 or 9 or 22, etc. files. For the first 5 files (insert any other number here) the program runs without an issue. It will finally cycle through, but randomly it will give a "File Already Exists" error.

I have run this with multiple set ups (some it would delete at the end of the sub function...trying it at the beginning to account for the other error), but I would get similar errors (i.e. - "Permission Denied" during the delete step). Has anyone run into something like this before? Does anyone have any suggestions?
Sign In or Register to comment.