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

IIf formula help

Status
Not open for further replies.

mddaniels

Programmer
May 13, 2009
26
US
Please, can someone tell me what is wrong with this formula?

IIF([Completed Date]>[Ordered Date][Completed Date-Ordered Date]),"Order Date Time After Completed")

The results should be if the Completed Date is greater than the Ordered Date, subtract the ordered date from the completed date, otherwise put in the field the comment "Order Date Time After Completed
 
with the exception of the seconds
[Ordered to Completed HH:MM]: IIf([Completed Date]>[Ordered Date],(24*Int([Completed Date]-[Ordered Date])+Format([Completed Date]-[Ordered Date],'h')) & Format([Completed Date]-[Ordered Date],':nn[!]:ss[/!]'),'Order DateTime After Completed')

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Can you tell me where the syntax error is in this expression?

SELECT ID, [Completed Date], [Procedure], [Dictating MD], Technologist, Location, [Ordered Date], [Arrived Date], IIf([Completed Date]>[Ordered Date],(24*Int([Completed Date]-[Ordered Date])+Format([Completed Date]-[Ordered Date],'h')) & Format([Completed Date]-[Ordered Date],':nn:ss'),'Order DateTime After Completed') AS [Ordered to Completed HH:MM]
FROM [Critical Value Quality Report tbl];
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top