AndrewKent
Well-known Member
- Joined
- Jul 26, 2006
- Messages
- 889
Okay,
I'm having a massive problem trying to setup a couple of Option Buttons in my userform. Basically I have the following code that depending on which option button is TRUE, will enable or disable parts of the userform...
But I'm finding that the Option Buttons are NOT populating their control sources on first click, the first click looks to be setting the focus, requiring a second click to "put the dot in the hole" which is setting the TRUE and FALSE values in the background.
Does anyone have any tips for setting up Option Buttons like this properly?
I'm having a massive problem trying to setup a couple of Option Buttons in my userform. Basically I have the following code that depending on which option button is TRUE, will enable or disable parts of the userform...
Code:
Private Sub obPolicyDetails1_Change()
Call AmountOfCover
End Sub
Private Sub obPolicyDetails2_Change()
Call AmountOfCover
End Sub
Private Sub AmountOfCover()
If obPolicyDetails1.Value = True And obPolicyDetails2.Value = False Then
lblPolicyDetails10.Enabled = False
lblPolicyDetails13.Enabled = False
txtPolicyDetails2.Enabled = False
txtPolicyDetails2.BackColor = &HF0F0F0
lblPolicyDetails11.Enabled = True
lblPolicyDetails14.Enabled = True
txtPolicyDetails3.Enabled = True
txtPolicyDetails2.BackColor = &HFFFFFF
Exit Sub
End If
If obPolicyDetails1.Value = False And obPolicyDetails2.Value = True Then
lblPolicyDetails10.Enabled = True
lblPolicyDetails13.Enabled = True
txtPolicyDetails2.Enabled = True
txtPolicyDetails2.BackColor = &HFFFFFF
lblPolicyDetails11.Enabled = False
lblPolicyDetails14.Enabled = False
txtPolicyDetails3.Enabled = False
txtPolicyDetails2.BackColor = &HF0F0F0
Exit Sub
End If
If obPolicyDetails1.Value = False And obPolicyDetails2.Value = False Then
lblPolicyDetails10.Enabled = False
lblPolicyDetails13.Enabled = False
txtPolicyDetails2.Enabled = False
txtPolicyDetails2.BackColor = &HF0F0F0
lblPolicyDetails11.Enabled = False
lblPolicyDetails14.Enabled = False
txtPolicyDetails3.Enabled = False
txtPolicyDetails2.BackColor = &HF0F0F0
Exit Sub
End If
End Sub
But I'm finding that the Option Buttons are NOT populating their control sources on first click, the first click looks to be setting the focus, requiring a second click to "put the dot in the hole" which is setting the TRUE and FALSE values in the background.
Does anyone have any tips for setting up Option Buttons like this properly?