Option Box

endri81

Registered User.
Local time
Today, 06:02
Joined
Jul 5, 2010
Messages
121
Hi
I have optionbox with 3 options related to 3 textboxes.
When I click first option first textbox activates the others disabled
When I click second option second textbox activates the others disabled
When I click third option third textbox activates the others disabled
How ca I write code for this because after first try of clicking three option buttons all textboxes remain active
 
In your Option Group's On Click event you will need some code that looks something like;
Code:
If Me.YourOptionGrpName = 1 Then
     Me.TextBox1.Enabled = True
     Me.TextBox2.Enabled = False
     Me.TextBox3.Enabled = False
Else If Me.YourOptionGrpName = 2 Then
     Me.TextBox1.Enabled = False
     Me.TextBox2.Enabled = True
     Me.TextBox3.Enabled = False
Else
     Me.TextBox1.Enabled = False
     Me.TextBox2.Enabled = False
     Me.TextBox3.Enabled = True
End If

You will of course need to change the names and values to reflect the names of the controls on your form and the values held by your Option Group.

You will also need this code in the Form's On Current event.
 

Users who are viewing this thread

Back
Top Bottom