Add Text Field Columns

B

bw

PFDB: IIf(Nz([PFDirect])+Nz([PFBulk])=0,"",Nz([PFBulk])+Nz([PFDirect]))

I have two fields both of which are text. When I try to add them as above, I get a
concatenated result, not the sum. How does one add them?

--
 
F

fredg

PFDB: IIf(Nz([PFDirect])+Nz([PFBulk])=0,"",Nz([PFBulk])+Nz([PFDirect]))

I have two fields both of which are text. When I try to add them as above, I get a
concatenated result, not the sum. How does one add them?

How does one add "This is text." + "this is also text"?
If both fields are Text, then your expression will concatenate them.

One adds numbers.
Now if the values within the text datatype fields are actually
numbers (0 - 9) as text, then you can try:

PFDB:
IIf(Nz(Val([PFDirect]),0)+Nz(Val([PFBulk]),0)=0,"",Nz(Val([PFBulk]),0)+Nz(Val([PFDirect]),0))
 
B

bw

Oh, thanks Fredg..
VAL is where it's at. I should have know this.

fredg said:
PFDB: IIf(Nz([PFDirect])+Nz([PFBulk])=0,"",Nz([PFBulk])+Nz([PFDirect]))

I have two fields both of which are text. When I try to add them as above, I get a
concatenated result, not the sum. How does one add them?

How does one add "This is text." + "this is also text"?
If both fields are Text, then your expression will concatenate them.

One adds numbers.
Now if the values within the text datatype fields are actually
numbers (0 - 9) as text, then you can try:

PFDB:
IIf(Nz(Val([PFDirect]),0)+Nz(Val([PFBulk]),0)=0,"",Nz(Val([PFBulk]),0)+Nz(Val([PFDirect]),0))
 
Top