Avatar of pdvsa
pdvsa
Flag 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

 

Capture.JPG
Microsoft Access

Avatar of undefined
Last Comment
Dale Fye

8/22/2022 - Mon
John Tsioumpris

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.
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
John Tsioumpris

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
pdvsa

ASKER
nice!  Worked perfectly.  thank you much!
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Dale Fye

@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