I
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Examine directory & use results in label (97)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Examine directory & use results in label (97)
- This topic has 3 replies, 4 voices, and was last updated 22 years, 4 months ago.
Viewing 1 reply threadAuthorReplies-
WScharlotte
AskWoody LoungerDecember 10, 2002 at 3:28 am #637480I’m sorry, but it isn’t entirely clear what you want to do. Why would you do this with buttons in the first place? That means that if the number of distributors change, you have to redesign your form. You can certainly set the caption property of a button from code, but it doesn’t appear that this is the best approach to your problem.
-
WSHansV
AskWoody LoungerDecember 10, 2002 at 6:55 am #637494As Charlotte mentioned, buttons are probably not the best way to do this – maintenance of the form will be a nightmare.
I would suggest creating a table that holds the distributor names and corresponding folder names. Something like
ID Distributor Folder 1 Aardvark Shippers Server1Share1Folder1 2 Le Corsaire Server2Share2Folder2 Adding, removing or modifying distributors is simple: edit the data in the table (or rather a form based on the table).
You need to write code to get the count of files in a folder.
Create a standard module.
In Tools/References…, set a reference to the Windows Scripting Host.
Put the following function in the module:Public Function FileCount(sFolder As String) As Long
On Error GoTo ErrHandler
Dim fso As New FileSystemObject
Dim fdr As Folder
Set fdr = fso.GetFolder(sFolder)
FileCount = fdr.Files.CountExitHandler:
Set fdr = Nothing
Set fso = Nothing
Exit FunctionErrHandler:
MsgBox Err.Description, vbExclamation
Resume ExitHandler
End FunctionNote: as it stands, this function shows an error message if the folder doesn’t exist. If you want to suppress this, handle Err = 76 separately; this is the error number that occurs when the path can’t be found.
Create a query based on your distributor table; add all fields you need plus the following calculated field:
ShippingFiles: FileCount([Folder])
Note: depending on the number of distributors and shipping files, this query may be slow.
Now, you can put a list box or continuous subform on your main form with the query as row source/record source.
-
WSpatt
AskWoody Lounger
-
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Is data that is in OneDrive also taking up space on my computer?
by
WShollis1818
57 minutes ago -
Nvidia just fixed an AMD Linux bug
by
Alex5723
19 hours, 9 minutes ago -
50 years and counting
by
Susan Bradley
3 hours, 4 minutes ago -
Fix Bluetooth Device Failed to Delete in Windows Settings
by
Drcard:))
1 hour, 54 minutes ago -
Licensing and pricing updates for on-premises server products coming July 2025
by
Alex5723
1 day, 6 hours ago -
Edge : Deprecating window.external.getHostEnvironmentValue()
by
Alex5723
1 day, 6 hours ago -
Rethinking Extension Data Consent: Clarity, Consistency, and Control
by
Alex5723
1 day, 6 hours ago -
OneNote and MS Word 365
by
CWBillow
1 day, 8 hours ago -
Ultimate Mac Buyers Guide 2025: Which Mac is Right For You?
by
Alex5723
1 day, 8 hours ago -
Intel Unison support ends on Windows 11 in June
by
Alex5723
1 day, 8 hours ago -
April 2025 — still issues with AMD + 24H2
by
Kevin Jones
1 day, 8 hours ago -
Windows 11 Insider Preview build 26200.5518 released to DEV
by
joep517
1 day, 20 hours ago -
Windows 11 Insider Preview build 26120.3671 (24H2) released to BETA
by
joep517
1 day, 20 hours ago -
Forcing(or trying to) save Local Documents to OneDrive
by
PateWilliam
2 days, 5 hours ago -
Hotpatch for Windows client now available (Enterprise)
by
Alex5723
1 day, 17 hours ago -
MS-DEFCON 2: Seven months and counting
by
Susan Bradley
18 hours, 5 minutes ago -
My 3 monitors go black & then the Taskbar is moved to center monitor
by
saturn2233
2 days, 14 hours ago -
Apple backports fixes
by
Susan Bradley
1 day, 20 hours ago -
Win 11 24H2 will not install
by
Michael1950
18 hours, 18 minutes ago -
Advice to convert MBR to GPT and install Windows 11 Pro on unsupported PC
by
Andy M
1 hour, 15 minutes ago -
Photos from iPhone to Win 10 duplicating/reformatting to .mov
by
J9438
1 day, 2 hours ago -
Thunderbird in trouble. Here comes Thundermail
by
Alex5723
3 hours, 5 minutes ago -
Get back ” Open With” in context menus
by
CWBillow
3 days, 4 hours ago -
Many AMD Ryzen 9800X3D on ASRock have died
by
Alex5723
1 day, 20 hours ago -
simple general stupid question
by
WSaltamirano
3 days, 2 hours ago -
April 2025 Office non-Security updates
by
PKCano
3 days, 19 hours ago -
Microsoft wants to hear from you
by
Will Fastie
1 day, 10 hours ago -
Windows 11 Insider Preview Build 22635.5160 (23H2) released to BETA
by
joep517
3 days, 23 hours ago -
Europe Seeks Alternatives to U.S. Cloud Providers
by
Alex5723
4 days, 4 hours ago -
Test post
by
Susan Bradley
4 days, 7 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.