Using the createtime to count items (1 Viewer)

mrrayj60

Registered User.
Local time
Today, 06:22
Joined
Sep 3, 2009
Messages
103
I need to make a report of the amount of records entered into a table based on shift hours; ie midnight shift entered X records, mornings did x and swing did x total entries for the day = xxx

how do I count using the time, >07:00:00 AM < 03:00:00 PM

Thanks, Ray
 

Sess

Registered User.
Local time
Today, 03:22
Joined
Jan 4, 2010
Messages
74
Make a field in the query, put the data test into an IIF statement and make true = 1 false = 0 and sum the field.
 

mrrayj60

Registered User.
Local time
Today, 06:22
Joined
Sep 3, 2009
Messages
103
Make a field in the query, put the data test into an IIF statement and make true = 1 false = 0 and sum the field.

IIf ( [visitorlog]![createtime] => 07:00:00 am and <= 03:00:00 pm , 1, 0)

gives me invalid syntax
 

Sess

Registered User.
Local time
Today, 03:22
Joined
Jan 4, 2010
Messages
74
You need to put # around a date/time
IIf ( [visitorlog]![createtime] => #07:00:00 AM# and <= #03:00:00 PM# , 1, 0)
 

MSAccessRookie

AWF VIP
Local time
Today, 06:22
Joined
May 2, 2008
Messages
3,428
You need to put # around a date/time
IIf ( [visitorlog]![createtime] => #07:00:00 AM# and <= #03:00:00 PM# , 1, 0)

There is still a Syntax Error here. Both sides of the AND comparison require the Field to test as well as a value to compare it to.

IIf ( [visitorlog]![createtime] => #07:00:00 AM# and [visitorlog]![createtime] <= #03:00:00 PM# , 1, 0)
 

SOS

Registered Lunatic
Local time
Today, 03:22
Joined
Aug 27, 2008
Messages
3,517
Or you can use the BETWEEN to select inclusively:

IIf ( [visitorlog]![createtime] Between #07:00:00 AM# and #03:00:00 PM# , 1, 0)
 

MSAccessRookie

AWF VIP
Local time
Today, 06:22
Joined
May 2, 2008
Messages
3,428
Or you can use the BETWEEN to select inclusively:

IIf ( [visitorlog]![createtime] Between #07:00:00 AM# and #03:00:00 PM# , 1, 0)

I agree with SOS, and although what I said above is accurate, using BETWEEN is a more appropriate choice.
 

Users who are viewing this thread

Top Bottom