disable certain fields

G

Greg

How can i disable fields if a certain value is selected.

If i select no in a option box field certain fields would be disabled
and if i select yes the fields would be enabled.
should i use another method besides and option box field?

any and all replys would greatly be appreciated.

Greg
 
G

Gerald Stanley

In the AfterUpdate event handler of the option box, place
code along the following lines

If {youroptionbox} then 'option box has been selected
{yourfield}.Enabled = True
etc
Else
{yourfield}.Enabled = False
etc
End If

Hope That Helps
Gerald Stanley MCSD
 
J

John Vinson

How can i disable fields if a certain value is selected.

If i select no in a option box field certain fields would be disabled
and if i select yes the fields would be enabled.
should i use another method besides and option box field?

any and all replys would greatly be appreciated.

Greg

You'll need just a little bit of VBA code to do this.

In the AfterUpdate of the option box put code like:

Private Sub Me!optMyOptionBox_AfterUpdate()
Select Case Me!optMyOptionbox
Case 1 ' the "yes" option
Me!thiscontrol.Enabled = True
Me!thatcontrol.Enabled = True
Case 2 ' the "no" option
Me!thiscontrol.Enabled = False
Me!thatcontrol.Enabled = False
Case Else
<do something appropriate>
End Select
End Sub

Put the same code in the Form's current event so that when the user
navigates to a new record the controls are set properly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top