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

NZ functions 1

Status
Not open for further replies.

drussum

Programmer
Jan 31, 2002
38
US
I have two fields that I am subtracting to equal another field. sometimes one of the two fields will not have any dollar value. What is the syntax for that? both fields are formated for $$
example:
[actual$]-[budget$]= [variance$]

I am currently using: Variance: NZ([actual]-[Budget])and I am getting allot of numbers and decimals.

Thanks in advance for any help.
 
Hi!

Try setting the default value for each field to 0 so that will never be a Null in the field.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Thanks for the suggestion, however the database is an oracle and I dont have the ability to do that. I have to make do with access.
 
If you're getting more decimal places than you want, you need to simply format the VARIANCE guy. Currency values are stored as two-byte double precisions, I think, so any 'regular' math you do on them will result in very precise results. Just reformat the results.

Variance: Format("####.##", NZ([actual]- [Budget])

or something like that.


Jim Hare
"Remember, you're unique - just like everyone else"
Feel free to visit another free Access forum:
or my site,
 
If you can have a negative result the approach would be different...


You should test the fields separately and return 0 rather than using NZ on the outcome of the subtraction. You can't do a mathematical operation with either of the values as NULL, which is what your function is allowing.

So,

Variance: Format(Nz([actual],0)- Nz([Budget],0)),"Currency")
 
it says "invalid Syntax". There could be negative numbers. in the variance field. How do I get the - sign to show up? (Negative sign)in the colmn with the dollar sign -$100.00
 
Hi!

Quehay had one extra closing parentheses:

Variance: Format(Nz([actual],0)- Nz([Budget],0),"Currency")

Should take care of the syntax problem.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Thanks, I am not getting the error anymore. What would the syntax look like if I were using 4 fields to add instead of the two?
 
Scratch the last qestion, Is there a way to have the "-" minus sign show up with in the ()parenthesis?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top