Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Collection Properties

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
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.
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…
Suggested Courses

636 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