IIf statement help needed

A

Ann P

I am trying to write an "IIf" expression to determine
during which shift a patient was placed in seclusion, but
I cannot get the statement correct. Can someone please
help me. Many thanks in advance.
The time frames are:
[Time In] is between 00:01 and 08:00 Shift 1
[Time In] is between 08:01 and 16:00, Shift 2
[Time In] is between 16:01 and 24:00, Shift 3
 
K

Ken Snell

Try this:

IIf([Time In] Between #00:01# And #08:00#, "Shift 1", IIf([Time In]
Between #08:01# And #16:00#, "Shift 2", "Shift 3"))
 
D

Douglas J. Steele

IIf([Time In] >= #0:01# And [Time In] <= #8:00#, "Shift 1", IIf([Time In] >
#8:00# And [Time In] <= #16:00#, "Shift 2", "Shift 3"))
 
S

Steve Schapel

Ann,

In addition to the good suggestions of Ken and Doug, you may be
interested to know that the Switch function can also be used for this
purpose...

Switch([Time In] Between #00:01# And #08:00#,"Shift 1",[Time In]
Between #08:01# And #16:00#,"Shift 2",True,"Shift 3")

- Steve Schapel, Microsoft Access MVP
 

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


Top