Syntax Help

pikoy

Registered User.
Local time
Today, 11:14
Joined
Dec 23, 2009
Messages
65
I am trying to get a total time for a project but only for those that have "YES" value on ProjectInit

Can someone help fix the code?

Thank you

Code:
=Fix(Sum([TotalProjectTime])/86400) & " Days, " & Format(Sum([TotalProjectTime])/86400,"hh:nn:ss") WHERE Project.ProjectInit='Yes'
 
Does it work without the where condition?
 
Does it work without the where condition?


Yes. it works very well. The only thing is, I cant isolate it to the ProjectInit = Yes
 
Is ProjectInit as text value or a boolean value?
 
The correct way is:
Code:
=IIf([Project].[ProjectInit] = "Yes", Fix(Sum([TotalProjectTime])/86400) & " Days, " & Format(Sum([TotalProjectTime])/86400,"hh:nn:ss"), "")
That displays nothing if it doesn't meet the criteria. Also, I included [Project] part in the IIF but if [ProjectInit] is in the record source of the form or report (you didn't say which you were using) then you just have to use [ProjectInit] and don't need the full quailified statement unless that field is also in another table that is in the form or report's record source.
 
SuperBob and DCrake - thank you for the reply as always.

Yes. i just had to remove the [Project] as they are on the same record source.

Solution worked perfectly.
 

Users who are viewing this thread

Back
Top Bottom