If a field = 0 then display text?

Is there a way in access to display certain text if a field = a certain number. For example if PH_STATUS = 0 then display closed IF PH_STATUS = 1 then display OPEN. I am not sure how to do this within access. Any help would be much appreciated!
HOTWATTAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dustin SaundersDirector of OperationsCommented:
There are a couple of ways to do that, but the better question is:

Are there only 2 statuses or are there multiple ones?

You will probably want a separate table for your statuses and then you can reference those values on your display.  Is that the case?
0
Dale FyeOwner, Developing Solutions LLCCommented:
in a textbox, you can set the ControlSource to:

=IIF([PH_Status]=0, 'Closed', 'Open')

But if you are talking about hiding a field based on the value of [PH_Status] you would have to use the FORM_Current and AfterUpdate event of the control that contains the value for [PH_Status] to then hide/reveal some other control, something like:

Private Sub txt_PH_Status_AfterUpdate

    me.SomeControlName.Visible = ([PH_Status] = 1)
0
Bill PrewCommented:
You can use the IIF() function, in a query.

If the valuses are always either 0 or 1 then:

IIF(PH_STATUS = 1, 'OPEN', 'CLOSED')

If there can be other values then:

IIF(PH_STATUS = 1, 'OPEN', IIF(PH_STATUS = 0, 'CLOSED', ''))


»bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

HOTWATTAuthor Commented:
there are more statuses but we are just looking at closed and open right now which are 0 and 1
0
HOTWATTAuthor Commented:
Thanks for the help! Bill that worked perfectly!
0
Bill PrewCommented:
Great, glad that helped.


»bp
0
Dustin SaundersDirector of OperationsCommented:
there are more statuses but we are just looking at closed and open right now which are 0 and 1

You should go ahead and design your form to accommodate this then.  Rather than a text field, you should make that a combo box that contains your status values, a few reasons off the cuff:

>You can add new statuses easily when needed.
>You can retire old statuses and retain their value as it was if desired by adding an 'Active' column to your statuses.
>Without this, any form you implement changes on will not be the same as others.  You have to go touch EACH place you have that condition.
>The combo box enforces data validation.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SQL

From novice to tech pro — start learning today.