default value of "No"

H

HelpMe!

Expr1: [Probation3]![Probe3PeriodEnd]>Now()

This returns a Yes/No depending on the date

If my [Probe3PeriodEnd] has no date, how can i set the default value to "No"
 
V

vanderghast

Expr1: Nz([Probation3]![Probe3PeriodEnd]>Now(), false)

Nz( a, b) returns the first argument, a, unless the first argument is
null, then it returns the second argument, b.


Since the first argument is a comparison, it returns either true, false, or
null. So, for compatibility, I assumed it is more appropriate to return
false than the STRING "No", while you can FORMAT the boolean getting out of
Expr1 further on, into "Yes" (true) or "No" (false).



Vanderghast, Access MVP
 
J

John Spencer

Use an expression like:

IIF([Probation3]![Probe3PeriodEnd] is Null, False,
[Probation3]![Probe3PeriodEnd]>Now())

or use NZ to force a value
Nz([Probation3]![Probe3PeriodEnd],Date())>Now()



John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
T

Tom van Stiphout

On Thu, 23 Jul 2009 13:10:01 -0700, HelpMe!

You could try wrapping it in an Nz function, and hoping that "" or 0
is less than Now, or you can be explicit:
Expr1: IIf(IsNull([Probation3]![Probe3PeriodEnd]),False,
[Probation3]![Probe3PeriodEnd]>Now())

-Tom.
Microsoft Access MVP
 
Top