Problem with Iif and a date box

B

Box666

I am trying to use "Iif" on a form and relating it to a date box. I am
trying to say that if the date box is blank then show a "2" in the
unbound text box

=iif([NewDate]=" ","2","3")

It keeps showing as "3" even when there is no date in the box. The date
field has an input mask set as the standard short date
"00/00/0000;0;_", is this producing the error, or is there something
else that I need to do.

Bob
 
J

John Spencer

Try
IIF( IsNull([NewDate]),2,3)
or if you really need the values to be text then surround them with quotes as
you did.

IIF(IsNull([NewDate]),"2","3")
 
R

Rick Brandt

Box666 said:
I am trying to use "Iif" on a form and relating it to a date box. I am
trying to say that if the date box is blank then show a "2" in the
unbound text box

=iif([NewDate]=" ","2","3")

It keeps showing as "3" even when there is no date in the box. The
date field has an input mask set as the standard short date
"00/00/0000;0;_", is this producing the error, or is there something
else that I need to do.

Bob

A "blank" control bound to a date field would be Null which is not the same as "
". Try...

=IIf(IsNull([NewDate]),"2","3")
 

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