I need qualifying date code for Iif statemen

  • Thread starter Thread starter Robin Chapple
  • Start date Start date
R

Robin Chapple

I have a membership reports that includes records of members with
"Leave of Absence".

This:

=IIf([StartLOA] Is Null,"","LOA")

is the code which I use. The table also has a field [EndLOA] which I
would prefer to use to remove the "LOA" from the report in favour of
the current method which is to edit the dates out.

So the expression needs to be something like:

=IIf([StartLOA] Is Null and [EndLOA] is > Today(),"","LOA")

or

=IIf([StartLOA] Is Null) and Iif([EndLOA] is > Today()),"","LOA"))

both of which give an error message. One says a comma is missing and
the other says too many arguments.

At least I tried. What is the correct code please?

Robin Chapple
 
I have a membership reports that includes records of members with
"Leave of Absence".

This:

=IIf([StartLOA] Is Null,"","LOA")

is the code which I use. The table also has a field [EndLOA] which I
would prefer to use to remove the "LOA" from the report in favour of
the current method which is to edit the dates out.

So the expression needs to be something like:

=IIf([StartLOA] Is Null and [EndLOA] is > Today(),"","LOA")

or

=IIf([StartLOA] Is Null) and Iif([EndLOA] is > Today()),"","LOA"))

both of which give an error message. One says a comma is missing and
the other says too many arguments.

At least I tried. What is the correct code please?

Robin Chapple


=IIf(IsNull([StartLOA]) and [EndLOA] > Date(),"","LOA")

Make sure the name of this control is not the same as the name of a
field used in this expression.
 
Thanks Fred,

I used your basis and rethought the code to this:

=IIf([EndLOA]>Date(),"LOA","")

which does exactly what I needed.

Robin

I have a membership reports that includes records of members with
"Leave of Absence".

This:

=IIf([StartLOA] Is Null,"","LOA")

is the code which I use. The table also has a field [EndLOA] which I
would prefer to use to remove the "LOA" from the report in favour of
the current method which is to edit the dates out.

So the expression needs to be something like:

=IIf([StartLOA] Is Null and [EndLOA] is > Today(),"","LOA")

or

=IIf([StartLOA] Is Null) and Iif([EndLOA] is > Today()),"","LOA"))

both of which give an error message. One says a comma is missing and
the other says too many arguments.

At least I tried. What is the correct code please?

Robin Chapple


=IIf(IsNull([StartLOA]) and [EndLOA] > Date(),"","LOA")

Make sure the name of this control is not the same as the name of a
field used in this expression.
 
Back
Top