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!

If statement for date config.

Status
Not open for further replies.

Quempel

MIS
Jun 23, 2005
15
US
I am trying to create an if statement to determine how many requests were not met within 48 hours

Fields
request date: 06/21/2005 10:03:00 AM
Todays date: 06/23/2005 10:34:00 AM

Any help would be much appreciated.

Thanks
Q
 
A query along the lines of:
Code:
SELECT * FROM NameOfYourTableHere WHERE NameOfYourRequestDateFieldHere <= Now()-2;
This assumes the field NameOfYourRequestDateFieldHere is formatted as Date/Time.

HTH.

[pc2]
 
Hi Quempel

datediff("h", Requestdate, Now())

will give the answer.

Be aware that your are checking the hours difference and it could turn out true the next second you check it!
 
Here is what entered for the query suggestions.

Field: Refcode Requestdate
Table: SLA-Incomplete SLA-Incomplete
Criteria: =Now()-2 Also tried
(h,Requestdate,Now()-2)


This is the error I receive:

Compile error. in query expression '(((OnLineResearch.Requestdate)=Now()-2))'.
Compile error. in query expression '(((OnLineResearch.Requestdate)=DateDiff(h, Requestdate,Now()-2))'.

Any suggestions on what I am doing wrong?

Q
 
Add this field with criteria to your query

Field --> Overdue :datediff("h", [Requestdate], Now())
Criteria --> >47

to get a result set of Overdue > 47

 
Added field and criteria - still get the same error.

Any other suggestions?

Q
 
Thank you all for your help...the problem was not your suggestions but the database itself. I got the same error when trying to run a macro that I have been using for years. That problem has been fixed and I entered your suggestions again and finally have what I was looking for.

Thank you, Thank you, Thank you.

Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top