I need qualifying date code for Iif statemen

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
 
F

fredg

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

Robin Chapple

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.
 

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