Using Between in an IIF statement

mtom5

New member
Local time
Yesterday, 22:40
Joined
Jun 28, 2005
Messages
7
I am trying to display Shift information in a query by using the following

IIf(Time([CALL IN]) Between (07:00) and (15:30),"1st Shift",IIF(Time([CALL IN]) Between (15:31) and (23:30) ,"2nd Shift",IIF(Time([CALL IN])Between (23:31) and (06:59) ,"3rd Shift"," ")))

and I am getting a message "The expression you entered has too many closing Parentheses"

Can anyone spot my error

Thanks
 
TIME() function returns the current system time. Probably not what you're trying to do.

My first thought is to try replacing your TIME() statements with

format([CALL IN], "hh:nn")

...perhaps. If this doesn't work, see the DATEPART() function. DATEPART will let you compare the hours or minutes in [CALL IN] with your criteria.

Let us know how it goes...
 
Problem solved

Thanks JOE C !!

I used you format tip and replaced some parens with "'s and it worked

Here is the working expression

Expr1: IIf(Format([CALL IN],"Short Time") Between "07:00" And "15:30","1st Shift",IIf(Format([CALL IN],"Short Time") Between "15:31" And "23:30","2nd Shift",IIf(Format([CALL IN],"Short Time") Between "23:31" And "06:59","3rd Shift"," ")))
 

Users who are viewing this thread

Back
Top Bottom