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
-
WU help needed with “Some settings are managed by your organization”
by
Peobody
3 hours, 14 minutes ago -
No Newsletters since 27 January
by
rog7
7 hours, 23 minutes ago -
Linux Mint Debian Edition 7 gets OEM support, death of Ubuntu-based Mint ?
by
Alex5723
7 hours, 44 minutes ago -
Windows Update “Areca Technology Corporation – System – 6.20.0.41”
by
Bruce
2 hours, 33 minutes ago -
Google One Storage Questions
by
LHiggins
10 hours, 4 minutes ago -
Button Missing for Automatic Apps Updates
by
pmcjr6142
5 hours, 20 minutes ago -
Ancient SSD thinks it’s new
by
WSila
2 hours, 19 minutes ago -
Washington State lab testing provider exposed health data of 1.6 million people
by
Nibbled To Death By Ducks
18 hours, 3 minutes ago -
WinRE KB5057589 fake out
by
Susan Bradley
11 hours, 22 minutes ago -
The April 2025 Windows RE update might show as unsuccessful in Windows Update
by
Susan Bradley
2 hours, 1 minute ago -
Firefox 137
by
Charlie
10 minutes ago -
Whisky, a popular Wine frontend for Mac gamers, is no more
by
Alex5723
1 day, 6 hours ago -
Windows 11 Insider Preview build 26120.3863 (24H2) released to BETA
by
joep517
1 day, 6 hours ago -
Windows 11 Insider Preview build 26200.5551 released to DEV
by
joep517
1 day, 6 hours ago -
New Windows 11 PC setup — can I start over in the middle to set up a local id?
by
ctRanger
2 hours, 29 minutes ago -
Windows 11 Insider Preview Build 26100.3902 (24H2) released to Release Preview
by
joep517
1 day, 10 hours ago -
Oracle kinda-sorta tells customers it was pwned
by
Nibbled To Death By Ducks
1 day, 16 hours ago -
Global data centers (AI) are driving a big increase in electricity demand
by
Kathy Stevens
2 days, 2 hours ago -
Office apps read-only for family members
by
b
2 days, 5 hours ago -
Defunct domain for Microsoft account
by
CWBillow
2 days, 2 hours ago -
24H2??
by
CWBillow
2 hours, 23 minutes ago -
W11 23H2 April Updates threw ‘class not registered’
by
WindowsPersister
1 day, 10 hours ago -
Master patch listing for April 8th, 2025
by
Susan Bradley
2 hours, 13 minutes ago -
TotalAV safety warning popup
by
Theodore Nicholson
1 day, 1 hour ago -
two pages side by side land scape
by
marc
4 days, 2 hours ago -
Deleting obsolete OneNote notebooks
by
afillat
4 days, 5 hours ago -
Word/Outlook 2024 vs Dragon Professional 16
by
Kathy Stevens
3 days, 7 hours ago -
Security Essentials or Defender?
by
MalcolmP
3 days, 10 hours ago -
April 2025 updates out
by
Susan Bradley
8 hours, 9 minutes ago -
Framework to stop selling some PCs in the US due to new tariffs
by
Alex5723
3 days, 4 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.