Hello,
I try to move a file which was created by an external batch-file. However sometimes the newly created file is not 1005 there yet, on the moment Access tries to move this file.
This might have to do with other processes on that computer (Outlook is checking Emails, internet pages are refreshed, etc).
To prevent unnecessary waiting-time, I did try to catch that 'Permission denied, Run-time error 70'-error into the 'On Error GoTo' function.
However, I do not succeed. The error is still shown on screen although the Error-trap should take another second 'Pause-time' before retrying the MoveFile command.
The script is as follows:
Private Sub StartProc_Click()
............
If Not rs.BOF And Not rs.EOF Then rs.MoveFirst
While (Not rs.EOF)
............
Call Shell(BatchFile, vbHide)
BatchFile:
On Error GoTo ErrTrap
TNow = Time
TWait = DateAdd("s", 1, TNow)
Do Until TNow >= TWait Or TNow - TWait < -0.05
TNow = Time
Loop
............
CopyFrom = [Forms]![DB - 05 - Create KAP bestanden]![ConversionMap] & "" & rs1.Fields("Map-name") & ".KAP"
CopyTo = [Forms]![DB - 05 - Create KAP bestanden]![KAPStore] & ""
On Error GoTo ErrTrap
fso.MoveFile CopyFrom, CopyTo
GoTo NextItem:
ErrTrap:
Resume BatchFile
End Sub
Can somebody explain, why the error-trap is letting me down?
Thanks on forehand