Time Calcultion Query

  • Thread starter Thread starter JaB
  • Start date Start date
J

JaB

Hi there

My database is designed to log details of phone calls so has a time field in
it which is completed to acknowledge the time of the call.

Id like to create a query that will return records but look in the time
field and ignore anything that was input in the previous 2 hours.

Does anyone have any ideas how to achieve this?

Thanks
 
Does the time field contain just the time or does it also contain the date?

If the field contains the date and time, you can use criteria of

Field: CallStart
Criteria: < DateAdd("h",-2,Now())

Of course that will go back forever. So presumably you want a range of time
(say the last 24 hours)

Criteria: Between DateAdd("h",-26,Now()) and DateAdd("h",-2,Now())


John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
My field is the data type 'date/time' and the format 'short time'.

Ive tried the second criteria but that bought back no records,any ideas?

Thanks
 
That is because I said the field must contain both the date and the time.

If you don't have a date associated with the call start then you will get
calls for multiple days. If you have only the time then you could try the
following.

Field: CallStart
Criteria: < DateAdd("h",-2,Time())

That will have problems if you run it before 2 AM in the morning, but should
work fine if you run it anytime after 2AM.

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top