We help IT Professionals succeed at work.
Get Started

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

216 Views
Last Modified: 2017-03-24
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
Comment
Watch Question
President / Owner
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2017
Commented:
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE