Showing status depending on other field

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

Guest

Two Fields "Date Closed" and "Status"

When "Date Closed" has no entry I need Status to display Open. When Date
Closed has an entry I want it to display Closed. Just remind me how I do it
again:)
 
That seems a bit redundant. Are you trying to do this in a form, report, or
query? You did not mention that in your post.
 
IIf(IsNull([Date Closed]), "Open", "Closed")

Alternatively, if it is possible for 'Date Closed' to contain an empty
string, the following will handle both Null values and empty strings ...

IIf(Len([Date Closed] & "") = 0, "Open", "Closed")
 
This could be for a form or report.

I seem to be having trouble getting this to work, chances are I'm not
putting it in the right place. I take it that for this to work it needs to go
in the Status field, so if Date Closed = Null then Status = Open or if Date
Closed = Not Null then Status = Closed - all seems simple enough, just not as
simple as I feel by not being able to get my head round it :)

Brendan Reynolds said:
IIf(IsNull([Date Closed]), "Open", "Closed")

Alternatively, if it is possible for 'Date Closed' to contain an empty
string, the following will handle both Null values and empty strings ...

IIf(Len([Date Closed] & "") = 0, "Open", "Closed")

--
Brendan Reynolds
Access MVP


Paul said:
Two Fields "Date Closed" and "Status"

When "Date Closed" has no entry I need Status to display Open. When Date
Closed has an entry I want it to display Closed. Just remind me how I do
it
again:)
 
In a form or report, you could use the expression in the ControlSource
property of an unbound text box. If using it in that way, you'd need a "="
in front of it ...

=IIf(IsNull([Date Closed]), "Open", "Closed")

Alternatively, you could use it as a calculated column in a query, and bind
your form or report to the query, in which case the syntax, in the Field row
in query design view, would look like so:

Status:IIf(IsNull([Date Closed]), "Open", "Closed")

(where 'Status' is the name to be used for the calculated column).

--
Brendan Reynolds
Access MVP

Paul said:
This could be for a form or report.

I seem to be having trouble getting this to work, chances are I'm not
putting it in the right place. I take it that for this to work it needs to
go
in the Status field, so if Date Closed = Null then Status = Open or if
Date
Closed = Not Null then Status = Closed - all seems simple enough, just not
as
simple as I feel by not being able to get my head round it :)

Brendan Reynolds said:
IIf(IsNull([Date Closed]), "Open", "Closed")

Alternatively, if it is possible for 'Date Closed' to contain an empty
string, the following will handle both Null values and empty strings ...

IIf(Len([Date Closed] & "") = 0, "Open", "Closed")

--
Brendan Reynolds
Access MVP


Paul said:
Two Fields "Date Closed" and "Status"

When "Date Closed" has no entry I need Status to display Open. When
Date
Closed has an entry I want it to display Closed. Just remind me how I
do
it
again:)
 

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

Back
Top