Re: Invalid procedure call or argument - Dir function



Bob O`Bob wrote:
Karl E. Peterson wrote:
Bob Butler <tiredofit@xxxxxxxxxxx> wrote:
"Karl E. Peterson" <karl@xxxxxxxx> wrote in message
news:ODDWOJpOHHA.5104@xxxxxxxxxxxxxxxxxxxx
guy_jara@xxxxxxxxx wrote:
Takeaway: It would appear that long periods of time between calls to
the Dir function causes it to loose "reference," if you will, to the
previously initialized search pattern, and moreover, to the function
itself.
That's an incredibly interesting observation! One that could be
tested, empirically, were one wanting to. It infers that VB is
calling FindClose after some set period of elapsed time. Hmmmmm....
I can't duplicate it and I think it's pretty unlikely. The odds are much
better that the code the OP is using calls Dir soemwhere in the file copy
routine to test for a file's existence and the time delay is a red herring.

That does sound like a more probably explanation, yep...


I think so, too.
But it shouldn't be hard to test.
I've just started a demo app that's going to wait longer and longer periods
between calls, starting at five minutes and adding 30 seconds each call.

I've got two instances running, with different start times by >10 minutes,
looking at the same directory, just in case somehow they interact.
I should be able to let them run for hours. We'll see.

The calls are now being logged just short of half an hour apart, and
both instances are still running fine.

After about another hour I'm going to call the elapsed time theory "busted!"


Bob

>
> By the way, that /is/ the error one gets if one makes another parameterless
> call after getting the empty string back. So a minor coding error is yet
> another higher probability, IMO.
--
.