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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time difference criteria in Query

Status
Not open for further replies.

matpj

Technical User
Mar 28, 2001
687
GB
I have a query that returns all records with Status NOT EQUAL 'closed'.

In this query I have a Date field of the format 'dd/mm/yyyy hh:mm:ss'.

I want to add a criteria that will display all records where Status IS NOT EQUAL 'Closed' AND current system date/time IS MORE THAN 3 hours greater than the Date field.

how is this possible?
any help will be appreciated!

Matthew
 

Add the following critera.

[date]<dateadd(&quot;h&quot;,-3,now())

Dateadd adds -3 hours to current time. Terry
------------------------------------
Blessed is the man who, having nothing to say, abstains from giving us worthy evidence of the fact. -George Eliot
 
Use DateAdd. Add 3 hours to the systemtime and compere.

[Date field] > DateAdd(&quot;h&quot;,3,Now())
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top