Select all fields on "tab"

OK...I am using the "on current" section of a Form of mine to do the following...

Private Sub Form_Current()

        If Me.cboProjectStatus = "COMP" Then
        Me.alternate_project_nbr.Enabled = False
        Me.alternate_project_nbr.Locked = True
        Me.cboCRM.Enabled = False
        Me.cboCRM.Locked = True
        Me.cboProjectSize.Enabled = False
        Me.cboProjectSize.Locked = True
        Me.cboPriority.Enabled = False
        Me.cboPriority.Locked = True
End If
End Sub

My question is I have to go through every field and specify it or can I specify the entire "tab section" of my form and will is select all of them that way?

I can do Me.tabDemand.Enabled = False

but that "dims" everything out.  I want it still "white" but just can't click on it.

Dark Magneto
Who is Participating?
shanesuebsahakarnConnect With a Mentor Commented:
Unfortunately not - tab controls and pages don't have an equivalent of the Locked option. They're either enabled or not, so you will need to cycle through the controls. One thing you could do is put something into the Tag properties of the controls (say the letter L) you want to lock and do something like this:

Dim ctl As Control

If Me!cboProjectStatus="COMP" Then
   For Each ctl In Me.Controls
      If ctl.Tag="L" Then
      End If
End If

This will save you from having to write and maintain a long string of If/Then statements.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.