Avatar of Clay Willing
Clay Willing
Flag for United Arab Emirates

asked on 

vba code to check folder size doesn't work on Win 7 PC's

I have an access based file monitor app that basically scans folder sizes to see if they have increased after x seconds (set by form timer property).  Each folder being scanned is being filled with data sniffed from winsockets and creating text files of data received and due to my winsocket program, i can see the data arriving so the data is indeed being stored.  
The code uses the filesystemobject - folder.size property to test for change and works perfectly well on Win XP PC's running Office 2010.  However when i copy the same accdb onto a win 7 machine, the code runs without error but does not detect and therefore update the underlying table.
I also re-wrote the code to iterate through sub folders to get the accumulated and therefore ultimate parent folder size and I get the same effect.  It just refuses to detect any change in the folder size.
Bizarrely, with the code running and showing my form, (a text box shows green if the folder size displayed in the box increases and reverts to red if the size remains the same) and I open a subfolder that I am testing with windows explorer, which shows the latest stored file, i can see the file size in details view change from zero to the proper size and my program responds appropriately.  If I do nothing, again the size reverts to the same as listed previously.  Once again, if I hit F5, the size in Win Ex changes and the program instantly responds.
I initially suspected some form of Windows 7 vaguery, so I borrowed a PC with a completely vanilla install of win 7 and got the same effect.
I have also checked Access references to ensure the scripting objects etc are all the same. Has anyone else come across a similar effect when using the fso?
I will post the detection code when I get back to my other PC.

Kind regards, a rather stumped vba access programmer
* WebSockets* monitorVBAWindows 7Microsoft Access

Avatar of undefined
Last Comment
Clay Willing

8/22/2022 - Mon