[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Set multiple cmd boxes to enabled = true

Posted on 2008-11-13
Medium Priority
Last Modified: 2013-12-25
Hi Experts,
Fairly simple one, but one that is bugging me...

I have 100 cmd boxes cmd1, cmd2, cmd3..... cmd100 upon clicking the rest button i want all of the cmdbuttons to set enabled = true. i know i could go through each one putting cmdX.enabled = true but it seems a bit messy. is there a way to do it in some kind of loop? e.g.:
for x = 1 to 100
         cmd & x.enabled = true

Thanks guys
Regards Matt
Question by:Matty_mca
LVL 11

Accepted Solution

Antagony1960 earned 200 total points
ID: 22955445
This will enable every button on the form:

Dim objControls
    For Each objControls In Me.Controls
        If TypeName(objControls) = "CommandButton" Then objControls.Enabled = True

If you need to limit the enabling to specific buttons you could perhaps put a value in their Tag property and check that before enabling them.

Author Closing Comment

ID: 31516605
Thanks Antagony1960.
Tag property also worked a treat

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month18 days, 22 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question