Reset/lock a control when a another control is selected (Option Gr

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a text box that is used to capture a date, however sometimes a date is
not a option. So I have a Option Group with 4 radio buttons.

What I'm trying to do is to disable/reset (grey out) the text box if the
option group is selected and vice versa, with a message box confirming each
time you make the selection.

I've tried using the validation rule but have had no success.
Thank you for your help!!!
 
You could try adding the following on the on_click of the option group:

Select case me.optiongroup
case=1
me.textbox.enabled=true(or false -> your decision)
case=2
me.textbox.enabled=true(or false -> your decision)
case=3
me.textbox.enabled=true(or false -> your decision)
case =4
me.textbox.enabled=true(or false -> your decision)
case else
me.textbox.enabled=true(or false -> your decision)
end select
 
What do you mean by "selected"?

The only thing I can suggest, based on your post, is that you can disable
one when data is entered in the other.

Use the After Update event of both of the controls to set the other's
Enabled Property.
 
Here's what I came up with...

Private Sub txtDate_AfterUpdate()

Dim Vdate As Integer

frmDate.Enabled = False
frmDate.Value = 0

Vdate = MsgBox("You can only select this field or the option group. Click
YES to select this field or NO to select from the option group.", vbYesNo,
"Date Verification")

If Vdate = 7 Then frmDate.Enabled = True Else End
If Vdate = 7 Then txtDate.Value = Null Else End

End Sub

It works for what I need it to do, along with the other control.

THANKS!!
 
Back
Top