Iif statement and time format

T

TDC

I have a table with a time field that displays a long form time (12:00:00 AM)
by default. Through a query I want to build a work shift field for grouping
these records. Below is an expression, but I know the time format is wrong.
What format do I use?

iif(([AccTime]between 6:01 and 18:00), "Day", "Night")
 
S

Stefan Hoffmann

hi,

What format do I use?

iif(([AccTime]between 6:01 and 18:00), "Day", "Night")

IIf(
TimeValue([AccTime]) >= #06:01#
AND TimeValue([AccTime]) <= #18:00#,
"Day",
"Night")


mfG
--> stefan <--
 
M

Marshall Barton

TDC said:
I have a table with a time field that displays a long form time (12:00:00 AM)
by default. Through a query I want to build a work shift field for grouping
these records. Below is an expression, but I know the time format is wrong.
What format do I use?

iif(([AccTime]between 6:01 and 18:00), "Day", "Night")


First, date/time values are stored as a Double, the format
is irrelevant to the question. The format is just a guide
on how it should be displayed.

When you want to use a date/time constant, you need to
enclose it in # signs.

IIf(AccTime Between #6:01# And #18:00#, "Day", "Night")
 

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