A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Iif statement and time format



 
 
Thread Tools Display Modes
  #1  
Old March 9th, 2010, 07:36 PM posted to microsoft.public.access.queries
TDC
external usenet poster
 
Posts: 22
Default Iif statement and time format

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")

--
TDC
  #2  
Old March 9th, 2010, 08:05 PM posted to microsoft.public.access.queries
Stefan Hoffmann
external usenet poster
 
Posts: 991
Default Iif statement and time format

hi,

On 09.03.2010 20:36, TDC wrote:
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 --
  #3  
Old March 9th, 2010, 08:40 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Iif statement and time format

TDC wrote:

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")

--
Marsh
MVP [MS Access]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:49 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.