How do i?

H

HelpMe!

(Please forgive me.. I am a newbie) How do i?

If [ProbeNumber] is 3 and [PeriodEnd] > Now then return "Yes"
If [ProbeNumber] is 3 and [PeriodEnd] < Now OR blank then return "No"
 
J

John Spencer

IIF(ProbeNumber = 3 and PeriodEnd > Now(),"YES","NO")

If you need to be doubly sure, you can nest two IIF statements and return Yes
for the first set of conditions, No for the second set of conditions, and NULL
if neither set of conditions is met.

IIF(ProbeNumber = 3 and PeriodEnd > Now(),"YES",IIF(ProbeNumber=3 and
(PeriodEnd < Now() or PeriodEnd is NULL),"No",Null))

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

Jerry Whittle

YesNo: IIf([ProbeNumber] = 3 AND [PeriodEnd] => Now(), "Yes", "No")

However the above will return No if the ProbeNumber is anything but 3.
 
F

fredg

(Please forgive me.. I am a newbie) How do i?

If [ProbeNumber] is 3 and [PeriodEnd] > Now then return "Yes"
If [ProbeNumber] is 3 and [PeriodEnd] < Now OR blank then return "No"

In a query? I'll assume the Time is NOT included in the [PeriodEnd]
field.

NewColumn:IIf([ProbeNumber] = 3 and [PeriodEnd] >
Date(),"Yes",IIf([ProbeNumber]=3 and [PeriodEnd]<Date(),"No","Neither
Yes nor No"))

1) Now includes a Date and Time value. If you use Now() in place of
Date() the results may differ according to the time of day you run the
query.

2) What result do you wish if the [PeriodEnd] is the current date?
Your question did not account for this.

3) What result do you wish if the value of [ProbeNumber] is not 3?
Your question did not account for this.
 

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