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

Total in Queries 1

Status
Not open for further replies.

mkc9929

Programmer
Joined
Nov 14, 2006
Messages
4
Location
US
I have a query that has dates of when an employee left work and came back on a worker's compensation claim, which they can do this up to five different times giving me 5 different dates to calculate. I have the five different dates in five columns in a query. This is example of the field with the number being changed 1-5;
[LDW1]-NZ[Return1],Now())+1. Some employees may only have 1 or 2 dates to calculate. I then added a calculated column into my grid called LostDays:[Expr1]+[Expr2]+[Expr3]+[Expr4]+[Expr5] with it summing in the total column. The problem is if there is no data in each and every column (which there isn't on all employees) it will not add them accross and if there is a calculated number of days in each field and it will add them across I am getting a result like 202.5544566. I am totaling confused--would it be better to total the number of lost days in a report. Thanks
 
CHANGE TO
NZ([Expr1],0)+NZ([Expr2],0)+NZ([Expr3],0)+NZ([Expr4],0)+NZ([Expr5],0)
 
Thanks so much, it worked. Can I ask you a question so that I understand how and why it worked? Did the "0" in the formula recognize the empty fields?

Thanks again...Melinda
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top