Hide Field based on Another

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

Guest

Hi,

I have a field call "Status". The content can be "Active" or "Non-Active".
If it is set to Non-Active, I want another field call "Reason" to be
displayed so the user can put an answer in that field, otherwise "Reason" is
not displayed. How can I do this in my form? Thanks very much.
 
You can use the code

Me.[Reason].Visible = (me.[Status] = "Non-Active")

If the criteria will return True, it will make the other field visible

Enter this code in two places
1. OnCurrent event of the form
2. AfterUpdate event of the field Status
 
Hi,

I have a field call "Status". The content can be "Active" or "Non-Active".
If it is set to Non-Active, I want another field call "Reason" to be
displayed so the user can put an answer in that field, otherwise "Reason" is
not displayed. How can I do this in my form? Thanks very much.

You can do this with one line of VBA code - but you need it twice. In both the
form's Current event and the Status control's AfterUpdate event, click the ...
icon; choose Code Builder; and add this between the Sub and End Sub lines that
Access gives you:

Me.Reason.Visible = (Me.Status = "Non-Active")


John W. Vinson [MVP]
 
Back
Top