Calculation on a Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form in which I have four text boxes: (among other things)

[Charges] [Payments] [Payroll] [Balance]

All the calculations work fine except for the [balance]. Here's the
expression for balance: =[chargetot]-[paytot]-[payroll]
Correct Example: 5,000 - 2,000 - 500 = 1500

As long as each field has a value in it, the balance is correct but if the
paytot or payroll fields are zero then it doesn't calculate the balance. It
just displays a #error in the balance field.
Wrong Example 5,000 - 2000 - 0 = #error
Should be 5000 - 2000 - 0 = 3000

Thanks
Stonewall
 
I have a form in which I have four text boxes: (among other things)

[Charges] [Payments] [Payroll] [Balance]

All the calculations work fine except for the [balance]. Here's the
expression for balance: =[chargetot]-[paytot]-[payroll]
Correct Example: 5,000 - 2,000 - 500 = 1500

As long as each field has a value in it, the balance is correct but if the
paytot or payroll fields are zero then it doesn't calculate the balance. It
just displays a #error in the balance field.
Wrong Example 5,000 - 2000 - 0 = #error
Should be 5000 - 2000 - 0 = 3000

Thanks
Stonewall

Look up the Nz function in VBA help.

=Nz([chargetot],0) - Nz([paytot],0) - Nz([payroll],0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top