IIf


C

clueless

Hi,
I am trying to put an IIf statement together. What I need it to basically
do is if a carrier arrives before 13:00 (1 pm), it's early. If it arrives
after 16:00 (4 pm), it's late, between 13:00 (1 pm) and 16:00 (4 pm) it is on
time. It does not error in design view but when I go to datasheet view, the
column reads Error. I would appreciate any help, not sure what I am doing
wrong. Thanks!

Expr1: IIf([SealNumber]="LTL" Or "LCL" And [ArrivalTime] Between "04:00" And
"12:59","early",IIf([SealNumber]="LTL" Or "LCL" And [ArrivalTime] Between
"16:01" And "03:59","Late","OnTime"))
 
Ad

Advertisements

J

John Spencer

You might try the following.

Expr1: IIf([SealNumber] IN ("LTL","LCL") And [ArrivalTime] Between
#04:00:00# And #12:59:59#,"early"
,IIf([SealNumber] In ("LTL", "LCL")
And ([ArrivalTime] Between #16:01:00# And #23:59:59#
OR ArrivalTime Between #00:00:00# and #03:59:00#),"Late","OnTime"))

Times and Dates are delimited by # markers not quotes.

You must repeat both sides of a comparison. So You can use the In
statement or you can use

(SealNumber = "LTL" or SealNumber = "LCL") AND ArrivalTime ...

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
Ad

Advertisements

C

clueless

Hi John,

Perfect!!!!! Thank you so much for your help.
--
clueless


John Spencer said:
You might try the following.

Expr1: IIf([SealNumber] IN ("LTL","LCL") And [ArrivalTime] Between
#04:00:00# And #12:59:59#,"early"
,IIf([SealNumber] In ("LTL", "LCL")
And ([ArrivalTime] Between #16:01:00# And #23:59:59#
OR ArrivalTime Between #00:00:00# and #03:59:00#),"Late","OnTime"))

Times and Dates are delimited by # markers not quotes.

You must repeat both sides of a comparison. So You can use the In
statement or you can use

(SealNumber = "LTL" or SealNumber = "LCL") AND ArrivalTime ...

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================

Hi,
I am trying to put an IIf statement together. What I need it to basically
do is if a carrier arrives before 13:00 (1 pm), it's early. If it arrives
after 16:00 (4 pm), it's late, between 13:00 (1 pm) and 16:00 (4 pm) it is on
time. It does not error in design view but when I go to datasheet view, the
column reads Error. I would appreciate any help, not sure what I am doing
wrong. Thanks!

Expr1: IIf([SealNumber]="LTL" Or "LCL" And [ArrivalTime] Between "04:00" And
"12:59","early",IIf([SealNumber]="LTL" Or "LCL" And [ArrivalTime] Between
"16:01" And "03:59","Late","OnTime"))
 

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

Similar Threads

IIF 2
Limits of IIF? 4
IIf statement 3
IIF statement?? 2
Problem with IIf 12
IIf statements 3
iif statement 4
IIF Function 2

Top