I have a program that loops forever picking up files and processing them every 5 minutes (in an outer loop) but after some time (not fixed but usually about 6 days) it stops picking up the files - I have found the problem to be that the filesearch.execute is eventually returning 0 even though files are present - stopping and restarting the program fixes the problem - any ideas gratefully received - code follows.......
' outer timing loop in main form - loops forever, entering here every 5 minutes
Set fsSearch = Application.FileSearch
fsSearch.LookIn = myIPpath ' set previously
fsSearch.FileName = "*.*"
If fsSearch.Execute > 0 Then ' eventually goes wrong and gets a zero even though files present
' process files here
End If
Set fsSearch = Nothing
DoCmd.close ' close this form
'end of timing loop
' outer timing loop in main form - loops forever, entering here every 5 minutes
Set fsSearch = Application.FileSearch
fsSearch.LookIn = myIPpath ' set previously
fsSearch.FileName = "*.*"
If fsSearch.Execute > 0 Then ' eventually goes wrong and gets a zero even though files present
' process files here
End If
Set fsSearch = Nothing
DoCmd.close ' close this form
'end of timing loop