Disable field, unless....

F

FpwL1399

I have a field that I would like to be disabled unless a value in a
drop down menu is selected. Is there any way to do this. I'm sure
there is. Thanks in advance.
 
S

SusanV

Set the field to locked in the On Current Event (Me.YourControl.Locked =
True), then toggle it to unlocked using the After Update event of the
dropdown:

If Me.YourComboBox = "SpecificValue" Then
Me.YourControl.Locked = False
Else Me.YourControl.Locked = True
End If
 
F

FpwL1399

Would that work for enabled instead of locked? I would kind of like it
to go gray when not in use.
 
F

FpwL1399

Awesome....except i'm having some trouble with it. I'm working on
troubleshooting it now....I'll let you know how it goes.
 
F

FpwL1399

Well, I'm having trouble getting it to work. I couldn't find the on
current box, so I just set the enabled box to NO. I put the code in
and made sure the names and everything was right, but it's not working.
Any suggestions?
 
F

FpwL1399

I found on current.... here is what I have so far:

Private Sub Form_Current()
Me.EngineeringThickness.Enabled = False
End Sub

Private Sub Form_AfterUpdate()
If Me.Combo30 = "Engr." Then
Me.EngineeringThickness.Enabled = True
Else
Me.EngineeringThickness.Enabled = False
End If
End Sub

Do you see anything wrong with this? If so, I would appreciate your
input.
 
S

SusanV

Yes exactly - sorry if I was unclear - this needs to go in the After Update
or OnCHange event of the Combobox, not the form.

My bad!

SusanV
 
Top