how to use IIf Function

Sorry for the late reply.
I am still stuck there.
 
Last edited:
Create a Query and include all the relevant fields.

Add an extra Field and put this in.

Days: DateDiff('d',[DeploymentFrom],[DeploymentTo])

Then use this in the Report with the new query as the Record Source.

=Sum(IIf([VehicleType]="H.Truck",[Days],0))

I tested this and it works.

PS

Could you place your Windows and Access versions in your Signature as there are some differences that we need

to know about from time to time.

RainLover....
Thank you sooooooo much...
This is so dumb of me, not understanding this in the first place.
After a month after seeing your last comment, I gave it a try again.
Found out what I was not doing right.

Thanks again...
much appreciated
 
Glad to hear you got it.
 
I have been looking for a smiley like that to express my sentiments, when screwing up! :D
 
Now that you've got it all worked out, I'll suggest what I think is a better alternative. Create a query that sums the data and a subreport to display it. Then put the subreport in the footer of the main report. It will appear only once on the last page of the report.

This solution is better because you don't need to know in advance all the possible values for Vehicle Type. With your current solution, you will need to remember to change this report if you ever add a new Vehicle Type.
 

Users who are viewing this thread

Back
Top Bottom