Solved

Collection Properties

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

685 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