Yes, I did it on one line and to make sure I had all of the syntax
correct
I
copied it and did a paste with changes. I put it in, then had to close
to
take a look and make sure that everyplace the JFdate was used it was in
date
format, yes. Then I re-opened the query and this is what it is now.
IIf(([Exp Cruda].[CPR])=IsNull([JFdate]) Or ([Exp
Cruda].[CPR])=IsNull([CPR]),"Null",IIf([CPR]>[JFdate],"OK",[CPR])), but
still
the same error.
--
Kautzen
:
Because it isn't obvious, that statement would be all on a single
line.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
message
Try something like:
IIf(IsNull([MyDateField]) OR IsNull([CPR]), "Null",
IIf([CPR]>[MyDateField],"OK",[CPR]))
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
So, I will change the name and see how this works. Also, if the
date
is
null, I want it to print null, so I shall put an or statement once
I
get
the
IIf to work. Thanks for your help. I have been looking through
many
of
the
questions and see when you answer it usually is the best advice. I
wll
also
keep te badword address for further help.
--
Kautzen
:
It looks as though date is the name of a field in one of your
tables.
Date
is a reserved word, and should never be used for your own
purposes.
For
a
comprehensive list of names to avoid in Access (as well as a link
to
a
free
utility that will check your application for compliance), see what
Allen
Browne has at
http://www.allenbrowne.com/AppIssueBadWord.html
Another potential problem is that your IIf statement doesn't
handle
the
case
where either CPR or date is Null.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
I have a query that gets the dates of expirations for trainings
that
I
want
to qualify the answer. Since the information is for three
trainings,
I
get
all or none, so I want to have the word "OK" replace the date it
the
training
expiration date is greater than the date of the request. CPR is
one
type
of
training, date is the date the request for expirations go
through.
Can
anyone help me understand why I can not get this IIf statement
to
work?
IIf([CPR]>[date],"OK",[CPR])