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

NZ( ) function

Status
Not open for further replies.

Joe1010

Programmer
Dec 11, 2006
49
US
I’m used to use the NZ( ) function in Access. What should I use in crystal?
Thanks
 
It would help if you explained what the NZ() function does in Access.

-LB
 
The Nz function is useful for expressions that may include Null values. To force an expression to evaluate to a non-Null value even when it contains a Null value, use the Nz function to return zero, a zero-length string, or a custom return value.

You can use the Nz function to return zero, a zero-length string (" "), or another specified value when a Variant is Null. Variant.
 
I'd say that ISNULL is similar, but you'll need to explore the differences.

Crystal assumes that anything with a null means that the field should not display, or the formula not complete. Always begin with something like
Code:
if isnull({your.amount}) then 0 
		         else {your.amount}
or
Code:
if isnull({your.date}) 
or {your.date} in [{Start-Date} to {End-Date}) then "OK"
else "not"
Or else
Code:
if isnull({your.amount})  
then "no value found" 
else ToText({your.amount})
The 'ToText' allows you to mix numbers and text, and also has interesting format options.

It helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods change between versions, and higher versions have extra options.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Consider going to file->report options->check "convert nulls to default values".

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top