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 Function in query? 1

Status
Not open for further replies.

monkeysee

Programmer
Sep 24, 2002
201
US
I have a query with the following fields: "InsPayment" and "Fee"
I want to have a calculated field named Adjustment. The Adjustment should calculate what to 'write-off' only after insurance pays their portion of the fee.
This is what I have for the Adjustment field: Adjustment: [fee]-[InsPayment]
So, if there is a fee of $50 and the insurance has not paid anything; As this is written, the Adjustment field returns the full fee as the write-off.
I do not want this to calculate unless there is an actual amount put in the inspayment column
What do I add to the formula to obtain this result?
As usual thank you so much for those out there helping those of us that are in need of advice!
 
I think you only need to use:

Code:
Adjustment: [fee]-Nz([InsPayment],0)

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
Thanks Duane,
I tried your suggestion and it is not returning the results I want. This is what it is returning:
Example 1: Fee: $50.00 Insurance Payment: 0 Adjustment: $50
Example 2: Fee: $50.00 Insurance Payment: 10 Adjustment: $40

Example 1: Result should be Adjustment 0 - since insurance has not yet paid any amount.
Example 2: Result is ok, because insurance payment has been received.
 
If [InsPayment] is nothing or empty then Nz will work, if 0 - no. If the value is 0, use iif function instead.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top