Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filesearch.execute stops working after some days 3

Status
Not open for further replies.

PizMac

Programmer
Nov 28, 2001
90
GB
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
 
not fixed but usually about 6 days

Well, I wouldn't pick Access to be something that runs 24/7 - it's not meant to be run like a "service".
 
I have the same problem. filesearch.execute returns 0.

This began occurring only recently. I think it may have something to do with Microsoft Updates or installing IE8 (worst browser ever).

Unfortunately, the only cure I've found is doing a "repair MS office" from the control panel Add/Remove office XP .

I've done this twice so far. I'm trying to figure out what's clobbering it.

It's definitely a bug. Not anything the code is doing wrong.
 
please keep me informed of any progress you make - and I'll do the the same here if I find a fix
Thanks a lot
 
One update, is that the .FileSearch function is deprecated/removed from Access 2007, which means you probably soon need a replacement anyway (for this rather annoyingly bugging function).

MS suggests Dir or FileSystemObject
While I like the FileSystemObject, it is probably the slowest method. Dir should be faster. Even faster, would probably be to use API's, check out for samples of all methods.

Roy-Vidar
 
Does it have to run 24/7? Is it possible to take the system down for 10 minutes every day/every other day, complete a compact and repair and restart.

Or. . .

Have you tried running your search under a counter. ie 5mins = 1, 10mins = 2, then after it gets to 1000 (or so), stopping the function and then restarting the function.

ie when it hits the 1000, close the form, open another form for 5 minutes, which then closes and opens the main form again to start from scratch.

I think your problem is a timing limit, so you'd probably want to clear and 'reboot' the main form and it will continue without error.

All the above is speculation, but it sounds feesible,

Let me know if this helps,

Fitz
Did you know, there are 10 types of people in this world:
* Those who understand binary
and
* Those who Don't!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top