Link to home
Start Free TrialLog in
Avatar of pdvsa
pdvsaFlag for United States of America

asked on

#Type! error

Experts,

Why would I get a #Type! and how can I get rid of it?
this is the formula I am using:  =Nz([txtAmount],0)-Nz([txtSumPmts],0)...Column A - Column D
I thought NZ would take care of it but it doesnt.  YOu can see some fields do not have the error and the ones that do there is a null.

thank you

 

User generated image
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

Probably you have a case apples with oranges...something holds a value of one datatype and another of another datatype.
try converting the values to see if this fixes it
Cdbl(Nz([txtAmount],0))-Cdbl(Nz([txtSumPmts],0))

Open in new window

If this fails share a sample for all of us to take a look.
Avatar of pdvsa

ASKER

Hi John, thanks...didint seem to be the trick though.  The fields are both currency if that matters.  

txtSumPmts is like this:  
=Format(DSum("Amount","qryPaymentsSum","LCID=" & [LetterOfCreditID] & ""),"Currency")

Amount is just simply [amount].  

Letme know if you have another idea....thanks!
ASKER CERTIFIED SOLUTION
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pdvsa

ASKER

nice!  Worked perfectly.  thank you much!
@pdvsa,

Just so you understand, the Format() function always returns a string. So if you are going to use that value in another computation, you would need to translate that back into a numeric value.  I'm willing to bet that John's original response was really close.  I would have recommended:

Val(Nz([txtAmount],0))-Val(Nz([txtSumPmts],0))

Open in new window