[AccessD] A2003+A2010 File Count in a folder - solved

Darren - Active Billing darren at activebilling.com.au
Sun May 8 20:47:48 CDT 2011


Hi guys 
Thanks for the responses.
I rejigged it all - especially taking note of what Stuart said about the
issue being in the loop not the call
I also got some of the math done at the start point and held them in globals
rather than doing the all the math each time in the loop
And it's all good
So it seems the logic and methods were (kinda) ok - the placement and order
of them was not
Many thanks for your ideas and pointers
Darren


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Sunday, 8 May 2011 6:19 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] A2003+A2010 File Count in a folder

Is the overfolw occurring in that sub, or in the timing loop that is
repeatedly calling that sub.  
I'd suspect the latter.    More complete example needed for diagnosis!

--
Stuart

On 7 May 2011 at 19:42, Darren - Active Billing wrote:

> Hi guys
> 
> I keep getting stack overflow errors - need help
> 
> We are creating XML files via some other process (Not Access) and I 
> just want to count them during the process.
> 
> I need to do it continually until the desired no of files is reached.
> 
> I am building a progress bar around this file creation process and on 
> some occasions we build thousands of files and it can take some time.
> 
> Of course I could sit there and watch the file count grow in an 
> Explorer window. But like I said this process can take ages.
> 
> Application.FileSearch won't work in Access 2010 so I can't use that 
> (I have a mix of 2003 and 2010 access versions).
> 
> Most of the code I have found on the interweb does the job but I 
> eventually run into stack overflows.
> 
> Here's a sample of one way that does work but eventually it overflows.
> 
> 
> 
> Private Sub f_fileCount(strPathFolder as string)
> 
>   Dim f As String
> 
>   Dim c As Long
> 
> 
> 
>   f = Dir$(strPathFolder & "*.xml")
> 
> 
> 
>   Do While Len(f) <> 0
> 
>     c = c + 1
> 
>     f = Dir$
> 
>   Loop
> 
> 
> 
> End sub
> 
> 
> 
> I have also tried the FSO and that too (eventually) gave Stack 
> Overflow errors.
> 
> I had it in mind to test the file count using the time say every 5-10 
> seconds to update the progress bar.
> 
> But it looks like this is not going to be possible
> 
> Anyone done this sort of thing before? Any pointers?
> Thanks heaps in advance team
> Darren
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 



-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list