Graying out fields based on a value in an Integer field

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

Guest

Hello,

I have a form with an Integer field that has Normal=1 and Abnormal=2. I
would like to gray out subsequent fields on the form depending on which value
is chosen. I have the following code for a Boolean field (see sample code),
but I can't quite figure out the code for an Integer field.

Sample code:
Private Sub brain_notd_AfterUpdate()
Dim blnEnable As Boolean
blnEnable = (Me.brain_notd.Value <> True)
Me.ctbraindt.Enabled = blnEnable
Me.Framectbrainres.Enabled = blnEnable
End Sub

I would like to adjust the above code to gray out subsequent fields
depending on whether 'Normal(=1)' or 'Abnormal(=2)' is chosen.

Thank you.
 
Hi, Pat.

All you need is:

If Me!MyIntegerField = (whichever value turns them off) Then
Me!Field1.Enabled = False
Me!Field2.Enabled = False
....etc.
End If

If the user can move to additional records, you'll also need the same code
plus turning them back on in the form's On Current event.

Sprinks
 
A big THANK YOU! It works like a charm. I was missing the Me! part (kinda
important!). Thanks again!
 
Back
Top