Hello,
I am trying to enable controls based on the value of a checkbox, i.e.
if value = true then enable.
I have a tab control form with controls on 4 tabs. I have some code
(below) on the tab control "on change" event.
This works for the 'first tab' but then does not work for any other
tab.
Any ideas?
Thanks!
Dave
Private Sub TabCtlPage2_Change()
CmdExit.SetFocus
'set the focus to exit button
Select Case TabCtlPage2.Value
Case Is = 1
For Each c In Me.Controls
If c.Tag = "PREABY" Then
c.Enabled = Nz(Me.checkbox_PREABY.Value, True)
End If
If c.Tag = "PREOBC" Then
c.Enabled = Nz(Me.checkbox_PREOBC.Value, True)
End If
If c.Tag = "PREMT" Then
c.Enabled = Nz(Me.checkbox_PREMT.Value, True)
End If
If c.Tag = "PREPMCT" Then
c.Enabled = Nz(Me.checkbox_PREPMCT.Value, True)
End If
Next
Case Is = 2
For Each c In Me.Controls
If c.Tag = "CAROVC" Then
c.Enabled = Nz(Me.checkbox_CAROVC.Value, True)
End If
If c.Tag = "CARVCT" Then
c.Enabled = Nz(Me.checkbox_CARVCT.Value, True)
End If
If c.Tag = "CARPCBH" Then
c.Enabled = Nz(Me.checkbox_CARPCBH.Value, True)
End If
If c.Tag = "CARPCTH" Then
c.Enabled = Nz(Me.checkbox_CARPCTH.Value, True)
End If
Next
Case Is = 3
For Each c In Me.Controls
If c.Tag = "TREART" Then
c.Enabled = Nz(Me.checkbox_TREART.Value, True)
End If
Next
End Select
End Sub