Solved

Collection Properties

Posted on 1998-09-15
3
159 Views
Last Modified: 2010-04-30
Here is my code:

Private Sub Form_Load()
Dim MYCONTROL As CommandButton
For Each MYCONTROL In Form6
MYCONTROL.Enabled = False
On Error GoTo Trap
Next
Trap:
     Err.Clear
   Resume Next

This does nothing to disable my commandbuttons.  If I change the first line to:

Dim MYCONTROL As control

it disables everything including the text box, menu control, etc.  How do I just disable commandbuttons or just menu bar or just text boxes?'  First and formost I need to know the command button.  But Please give me code for the other controls too.

Thank you.

It seems easy enough?

0
Comment
Question by:check1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
bharris1 earned 50 total points
ID: 1435102
Your code works for me, I don't know why you're having problems with it.  You could also do this:

Private Sub Form_Load()
Dim MYCONTROL As Control
    For Each MYCONTROL In Form6
        If TypeOf MYCONTROL Is CommandButton Then
            MYCONTROL.Enabled = False
        End If
    Next
End Sub

Then you can replace the TypeOf statement with whatever control you want to disable
0
 

Author Comment

by:check1
ID: 1435103
This is exactly what I needed.  I don't know why the first one does not work.

Thanks!
0
 

Author Comment

by:check1
ID: 1435104
This is exactly what I needed.  I don't know why the first one does not work.

Thanks!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using "ScreenUpdating" 6 85
Assign a value in Excel V-Basic 3 36
Excel Macro update each line based on another worksheet 2 53
SQL Server 2012 to SQL Server 2016 24 54
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

737 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