I am sending MS Access files to a zip file to back them up every night by means of an MS Access file. Some are large files, upwards of 2GB, which take 5 to 10 minutes to zip on our slow shared drive network. I want my ACCDB file to pause until the file has been completely copied into the zip file before moving on to the next file. It currently just goes on to the next file almost immediately and things get messed up pretty quickly, especially since I am killing the MS Access file after it gets copied into the zip.
Try to find the file in the zip, and then I will eventually build a loop with a timer that goes until the Dir exists.
'copy files to zip Dim shl As New Shell32.Shell shl.NameSpace(strZipFilePath).CopyHere (strZip) Set sh = CreateObject("Shell.Application") x = GetFiles(strPath, "*.zip", True) 'This crashes Access For Each i In x Set n = sh.NameSpace(i) Debug.Print n Next i End
Pause for 600 seconds... sometimes this works, other times it doesn't, just depends on network traffic.
Do While Dir(strZip) <> 0 sngStart = "" sngStart = Timer Do While Timer < sngStart + 600 '10 minutes=600 seconds DoEvents Loop Loop