Solved

Collection Properties

Posted on 1998-09-15
3
153 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
  • 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now