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

NZ

Status
Not open for further replies.

Fensbo

Programmer
May 19, 2005
12
SE
Hi there, I can't seem to get this to work CPR NZ: NZ([Bil_CPR];0) in a query. It should return 0 (zero) if the field [Bil_CPR] is null...?!

What am I doing wrong?!
 
But - what does it return?

One guess, the field isn't Null but contains ZLS (zero length string ""), which isn't trapped by NZ.

[tt]iif(trim$(Bil_CPR & "")="";0;Bil_CPR)[/tt]

Roy-Vidar
 
I'm assuming the ; in NZ is a typo, and that you have a comma instead?

Otherwise Royvidar is on the right track, but do this:
Nz(trim$("" & [fieldname]),0)

Trim$ returns a string. I put the concat of the "" in to force any NULL to an empty string.
--Jim
 
Jim, "" & [fieldname] will NEVER return null.
 
Hi there,

No it's not a typo, it will not accept "," only ";"...?!

/Christian
 
It's standard behaviour on some european package.
 
Here's a thrad with a bit of explanation on the semicolon vs comma thread702-733634 thingie

Roy-Vidar
 
Okay, I'm using Danish standard...

:eek:)
 
phv,frensbo,
My mistake--I meant to put the trim$("" & [fieldname]) in an IIF() statement and NOT Nz(). I'm well aware that it wont' return null, that's the whole reason for concatenating the "".

Sorry for the confusion.
--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top