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

Problem getting sum field to calculate if one field is empty

Status
Not open for further replies.

neronikita

Technical User
Feb 20, 2002
159
0
0
US
I am pulling reports in Crystal 2008 from an Access 2007 database. I have a field that sums up three fields in the database. If one of those fields is empty, it doesn't display the total for the other fields, it leaves the sum field empty. Is there any way to resolve this? I figured out to use the NZ function within access in the same scenario, but haven't found an equivalent for Crystal.

Thanks!

Di
 
Fields are empty, you mean NULL in this case.

If it is so,

you can replace NULL with 0 so that when you add up these you get correct summary.

You can use REPLACE, ISNULL functions to replace blank space to 0

(As these take string values only, use ToText and then ToNumber conversions)
 
thanks. So how would I add that to this formula?

({@MilesCharge}+{@StopCharge}+{TripInfo.FuelCharge})

I've never done those conversions.

Thanks,

Di
 
(
if isnull({@MilesCharge}) then
0 else
{@MilesCharge}
)+
(
if isnull({@StopCharge}) then
0 else
{@StopCharge}
)+
(
if isnull({TripInfo.FuelCharge}) then
0 else
{TripInfo.FuelCharge}
)

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top