Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

report on activity between 12 am and 8 am

Status
Not open for further replies.

pscad

MIS
Sep 11, 2001
21
US
I have a single table that has date and time info in one field, such as '6/2/2003 12:51:04'. What I am being asked to do is to report all activity on ALL dates but only that which happened between 12:00 and 8:00. The time is 24-hour formatted, so there won't be any confusion between midnight and noon. I'm basically looking for a "Select * from EvnLog where DATE > x/x/xx 12:00 and DATE < x/x/xx 8:00", but of course, that doesn't work.

TIA.
 
Yeah, I feel like a dork! I figured it out.
TimeValue([EvnLog]![TimeDate])<#8:01:00 AM#

maybe this will help someone else!?
 
Try
[tt]
WHERE Hour(myDate] < 8
[/tt]

If your date field is named "Date" then you will need to enclose it in brackets [Date].
 
I do things like this using the query wizard. I created a Time column Time:format([DateTime],"hh:mm")) with >#08:00# and #<12:00# as the criteria, and got this from the SQL view:
[green]
SELECT DateTime.ID, DateTime.Datetime, Format([DateTime],"Short Time") AS [Time]
FROM [DateTime]
WHERE (((Format([DateTime],"hh:mm"))>#12/30/1899 8:0:0# And (Format([DateTime],"Short Time"))<#12/30/1899 12:0:0#)); [/green]

It seems to do the job - I'm just lazy!

Simon Rouse
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top