troubleshooting Question

Why is the code not working to enable and disable command buttons?

Avatar of cssc1
cssc1Flag for United States of America asked on
Microsoft Access
15 Comments12 Solutions319 ViewsLast Modified:
I have 30 command buttons on a form and I need to activate or deactivae the each command button depending on the check box selection. I am not a coder but I found some code online and it worked fine for one command button but not for more than one. The code that does not work is:
Private Sub Form_Load()
   If Ctl2 - HumanEngineering = True Then
        Me.Command104.Enabled = True
    ElseIf 2 - HumanEngineering = False Then
         Me.Command104.Enabled = False
    End If

   If Ctl2 - Procedures = True Then
        Me.Command105.Enabled = True
    ElseIf Ctl2 - Procedures = False Then
         Me.Command105.Enabled = False
    End If

   If Ctl2_Work_Direction = True Then
        Me.Command106.Enabled = True
    ElseIf Ctl2_Work_Direction = False Then
         Me.Command106.Enabled = False
    End If
End Sub
Join our community to see this answer!
Unlock 12 Answers and 15 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 12 Answers and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros