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

How in a Calculated Field do I make an empty string forced to zero 1

Status
Not open for further replies.

justagrunt

Technical User
Oct 10, 2002
132
Hi,
Sorry for the Title.
I am adding a number of fields in a calclated field.
The feilds that I am adding return an empty string sometimes. The tables that they are based on have default values of zero but this doesn't seem to be helping.
Basically I have a time sheet query with three separate department hours for a job. Each department has a fixed dollar hourly rate. A separate calculation feild mutiplies the summed hours for each department and mutiplies it by a dollar value in a new feild. In the query some departments show no hours and no dollars and return an empty string for that calculated feild. When I add all these calculated fields together in a result field even if one or two feilds have a value I return an empty string. If all three have a value then the addition works. Can I set a default value of something in the calculated feilds of 0 so that there is some value to add. I believe it is this empty string that is causing the main addition to show an empty string.
Sorry for the double dutch.
Warm Regards
bill
 


I am confused.

Could you post your code?

Skip,

[glasses] [red]Be advised:[/red] Researchers have found another Descartes trueism, "Cogito ergo spud."
"I think; therefore, I YAM!
[tongue]
 
Sorry Skip all of it is query based not code.
A time sheet is raised for a job.
Three queries split out the different departments hours.
Depending on the job a department may not have any hours.
Three separate queries sums the hours of each department and in each a calculated feild applies a dollar rate.
Another query tries to sum the dollar values in a calclated feild with this code,
TimeDollar: [WCExpensesDT]![Dollars]+[WCExpensesET]![Dollars]+[WCExpensesFTQuery]![Dollars]
Any empty string in one of the feilds and I get nothing.
Warm Regards
Bill
 
use the NZ function on the first level of queries that references the fields that may be blank:

nz(Field1,0)




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top