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
-
It’s Identity Theft Day!
by
Susan Bradley
7 minutes ago -
Android 15 require minimum 32GB of storage
by
Alex5723
3 hours, 17 minutes ago -
Mac Mini 2018, iPhone 6s 2015 Are Now Vintage
by
Alex5723
3 hours, 26 minutes ago -
Hertz says hackers stole customer credit card and driver’s license data
by
Alex5723
3 hours, 57 minutes ago -
advice for setting up a new windows computer (Awaiting moderation)
by
routtco1001
4 hours, 18 minutes ago -
Firefox became sluggish
by
Rick Corbett
51 minutes ago -
Windows 10 Build 19045.5794 (22H2) to Release Preview Channel
by
joep517
7 hours, 55 minutes ago -
Windows 11 Insider Preview Build 22635.5235 (23H2) released to BETA
by
joep517
8 hours, 24 minutes ago -
A Funny Thing Happened on the Way to the Forum
by
bbearren
3 hours, 55 minutes ago -
Download speeds only 0.3Mbps after 24H2 upgrade on WiFi and Ethernet
by
John
5 hours, 18 minutes ago -
T-Mobile 5G Wireless Internet
by
WSmmi16
10 hours, 19 minutes ago -
Clock missing above calendar in Windows 10
by
WSCape Sand
1 hour, 28 minutes ago -
Formula to Calculate Q1, Q2, Q3, or Q4 of the Year?
by
WSJon5
23 hours, 10 minutes ago -
The time has come for AI-generated art
by
Catherine Barrett
3 hours, 13 minutes ago -
Hackers are using two-factor authentication to infect you
by
B. Livingston
12 hours, 54 minutes ago -
23 and you
by
Max Stul Oppenheimer
20 hours, 8 minutes ago -
April’s deluge of patches
by
Susan Bradley
1 hour, 28 minutes ago -
Windows 11 Windows Updater question
by
Tex265
31 minutes ago -
Key, Key, my kingdom for a Key!
by
RetiredGeek
2 days, 4 hours ago -
Registry Patches for Windows 10
by
Drcard:))
2 days, 9 hours ago -
Cannot get line length to NOT wrap in Outlining in Word 365
by
CWBillow
1 day, 16 hours ago -
DDU (Display Driver Uninstaller) updates
by
Alex5723
1 day, 1 hour ago -
Align objects on a OneNote page
by
CWBillow
2 days, 14 hours ago -
OneNote Send To button?
by
CWBillow
2 days, 15 hours ago -
WU help needed with “Some settings are managed by your organization”
by
Peobody
3 days ago -
No Newsletters since 27 January
by
rog7
1 day, 4 hours ago -
Linux Mint Debian Edition 7 gets OEM support, death of Ubuntu-based Mint ?
by
Alex5723
2 days ago -
Windows Update “Areca Technology Corporation – System – 6.20.0.41”
by
Bruce
1 day, 23 hours ago -
Google One Storage Questions
by
LHiggins
1 day, 7 hours ago -
Button Missing for Automatic Apps Updates
by
pmcjr6142
1 day, 14 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.