Hide Field based on Another

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.
 
G

Guest

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
 
J

John W. Vinson

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]
 

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