Hi everyone
I have a problem which i am sure is quite straightforward to solve, but you know what it’s like when you don’t know the answer…. ๐
OK. I have written some code to copy files at night. I use a table full of file locations and a Do Until….. Loop to work through thr recordset. This weekend i came across a problem. A user had moved/renamed one of the files and the code bombed out.
I have found a function that checks for the existance of each file, and returns a boolean value depending on whether it exists or not. So far, so good……
My problem is getting the code to exit the loop at that point on finding no file, and going back to the beginning of the Do Until, in other words moving down to the next record.
I’ve tried Exit Do, but that just takes me right out of my looping procedure, and i’m not sure how to use the Resume statement.
Here’s the bit of my procedure where i think i need to put the new code:
Set db = CurrentDb
Set mytable = db.OpenRecordset(“tblFilestoBackUp”)
If mytable.RecordCount = 0 Then
Exit Sub
Else
mytable.MoveFirst
If Not mytable.BOF Then
Do Until mytable.EOF
strOldFileName = mytable(“FilestoBackUp”)
Dim intDirExist As Integer
intDirExist = fIsFileDIR(“FilestoBackUp”)
Select Case intDirExist
Case 0
****NEW CODE HERE THAT STARTS NEW LOOP***
End Select
Code continues until recordset is completed…………….