entering data based on result of previous field

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

Guest

I am trying to work out how I can set the properties of a field so that it
stays greyed out unless a particular field's entry is True. I am writing a
database that will record various issues relating to Information Governance.
There is a specific question relating to laptops and I only want these fields
completed by those with laptops. Therefore the default answer will be No but
if changed to Yes the next three fields will activate. Can anybody help?
This is the first time I have used the site and I thank all in advance for
any help they can give.

Thanks

David
 
Hi, David.

Whether a form control is available to the user is controlled by the Enabled
property. For the laptop-only controls, set the default Enabled property
value to True in form design mode. Then in the On Update event procedure for
the Yes/No field, set Enabled to True:

Private Sub YourYesNoControl_AfterUpdate()
If Me!YourYesNoControl = True Then
Me!YourFirstControl.Enabled = True
Me!YourSecondControl.Enabled = True
Me!YourThirdControl.Enabled = True
Else
Me!YourFirstControl.Enabled = False
Me!YourSecondControl.Enabled = False
Me!YourThirdControl.Enabled = False
End If
End Sub

If you additionally want the control to disappear entirely, rather than
simply greyed out, set the default Visible property to False also, and turn
it on when needed. You can assign multiple properties to a control with the
With..End With construct, e.g.,

With YourFirstControl
.Enabled = True
.Visible = True
End With

HTH
Kevin Sprinkel
 
Back
Top