?
Solved

Collection Properties

Posted on 1998-09-15
3
Medium Priority
?
161 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 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

801 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