Nested IIf & Error: "Text is too long to be edited"

  • Thread starter Thread starter croy
  • Start date Start date
C

croy

When I try to put my nested IIf statement into a query, I
get the "Text is too long to be edited" message.

Here's the text:

HrDivisor:
IIf(DatePart("h",[Start])=(DatePart("h",[Finish]),1,IIf(DatePart("n",[Start])=0
And DatePart("n",[Finish])=0,1 +
(DatePart("h",[Finish])-DatePart("h",[Start])-1),IIf(DatePart("n",[Start])=0,1
+
(DatePart("n",[Finish])/((60-DatePart("n",[Start]))+DatePart("n",[Finish]))
+
(DatePart("h",[Finish])-DatePart("h",[Start])-1),IIf(DatePart("n",[Finish])=0,((60-DatePart("n",[Start]))/(60-DatePart("n",[Start])+DatePart("n",[Finish])))
+
(DatePart("h",[Finish])-DatePart("h",[Start])),((60-DatePart("n",[Start]))/(60-DatePart("n",[Start])+DatePart("n",[Finish])))
+
(DatePart("n",[Finish])/((60-DatePart("n",[Start]))+DatePart("n",[Finish])))
+ (DatePart("h",[Finish])-DatePart("h",[Start])-1)))))



Is this really too much text, or do I have an error in there
somewhere?
 
An IIF statement can only be 2048 characters and that includes commas,
parenthesis and everything.
 
When I try to put my nested IIf statement into a query, I
get the "Text is too long to be edited" message.

Here's the text:

HrDivisor:
IIf(DatePart("h",[Start])=(DatePart("h",[Finish]),1,IIf(DatePart("n",[Start])=0
And DatePart("n",[Finish])=0,1 +
(DatePart("h",[Finish])-DatePart("h",[Start])-1),IIf(DatePart("n",[Start])=0,1
+
(DatePart("n",[Finish])/((60-DatePart("n",[Start]))+DatePart("n",[Finish]))
+
(DatePart("h",[Finish])-DatePart("h",[Start])-1),IIf(DatePart("n",[Finish])=0,((60-DatePart("n",[Start]))/(60-DatePart("n",[Start])+DatePart("n",[Finish])))
+
(DatePart("h",[Finish])-DatePart("h",[Start])),((60-DatePart("n",[Start]))/(60-DatePart("n",[Start])+DatePart("n",[Finish])))
+
(DatePart("n",[Finish])/((60-DatePart("n",[Start]))+DatePart("n",[Finish])))
+ (DatePart("h",[Finish])-DatePart("h",[Start])-1)))))

Could you explain in words what this is intended to accomplish? If you want to
display the duration from Start to Finish in hh:nn format, try instead:

DateDiff("h", [Start], [Finish]) & ":" & Format(DateDiff("n", [Start],
[Finish]) MOD 60, "00")
 
Back
Top