Help with disabling a text box based on an option group selection

Troy1977

New member
Local time
Today, 17:25
Joined
Mar 14, 2009
Messages
4
Ok, I'm trying to get a text box to only become enabled if a particular selection is made in an option group on the same form.
Here's the details...

OptionGroup = PaymentTypeOptions
Option1 = Cash
Option2 = Check
Option3 = Money Order

OptionGroup updates field "Payment Type" in table "Payments".

I have text box "Check#" that I only want enabled if option2 is selected.

I tried to do it this way but it doesn't do anything.

Private Sub PaymentTypeOptions_AfterUpdate()
If PaymentTypeOptions.Value = 2 Then
Check#.Enabled = True
Else
Check#.Enabled = False
End If
End Sub

Not sure if this is the correct way of doing this.

Any help would be appreciated.

Thanks in advance,
Troy1977
 
That's an appropriate way of accomplishing the goal. Because of the inadvisable symbol, try:

Me.[Check#].Enabled = True

or better yet change the textbox name.
 
Ok, I changed the field name to "Check". Where do I need to set this code? I tried putting it in the forms "On Current" option but then it only works if all of them are set to the same option number. This is a continous form as it's a payment record.
 
Generally you'd use the after update event of the option group to catch the change of the selection and the current event to catch the changing of records. With a continuous form, you may want to try Conditional Formatting, so that records without focus have the correct setting.
 

Users who are viewing this thread

Back
Top Bottom