Results 1 to 4 of 4
  1. #1
    Jojojo is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2011
    Posts
    46

    Total Calculation, nz function, not working

    I have two forms that do the exact same calculations (1 for class registrations and 1 for massages). Everything is the same, in fact it's copied and pasted and then fields references were changed. I can't figure out what is missing and why it doesn't work when the fee is blank. If someone could take a peak and maybe see something I don't, that would be great. They work when there is a fee - the Registration will show a total $0 when the fee hasn't been put in yet. The Massage Registration will show #Error when there is no fee inputed (but works when there is a fee)

    Form 1: Registration
    Form 2: MassageRegistration

    Each has 4 fields.

    Registration has:
    Reigstration Fee: RegistrationFee
    Sales Tax Rate: SalesTaxRate
    Sales Tax: =CLng((([SalesTaxRate]*nz([RegistrationFee]))*100))/100
    Total Charges: =[RegistrationFee]+[Sales Tax]

    Massage Registration has:
    Massage Fee: MassageFee
    Sales Tax Rate: SalesTaxRate


    Sales Tax: =CLng((([SalesTaxRate]*nz([MassageFee]))*100))/100
    Total Charges: =[MassageFee]+[Sales Tax]

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The NZ() function is missing an argument in two places. I added it (in red). I don't know if these changes will solve your problem, but it is how I would do it:

    Code:
    Registration has:
    Reigstration Fee: NZ(RegistrationFee,0)
    Sales Tax Rate: SalesTaxRate
    Sales Tax: =CLng((([SalesTaxRate]*nz([RegistrationFee],0))*100))/100
    Total Charges: =NZ([RegistrationFee],0)+[Sales Tax]
     
    Massage Registration has:
    Massage Fee: NZ(MassageFee,0)
    Sales Tax Rate: SalesTaxRate
    Sales Tax: =CLng((([SalesTaxRate]*nz([MassageFee],0))*100))/100
    Total Charges: =NZ([MassageFee],0)+[Sales Tax]

  3. #3
    Jojojo is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2011
    Posts
    46
    I added the missing part of the function - and it actually didn't make any difference. I did leave that code in now though (I had tried before but it didn't make a difference so I deleted it). I should also mention that the MassageFee and Registration Fees are not pulled from somewhere, the user enters the amount each time in this field, so I ommitted the Nz funtion that you suggested here as it produced a #Name? error.

    What I am confused by, is the Registration form works - it's the MassageRegistration form that doesn't - and they are basically the exact same cells, formula's etc. I double checked the tables to make sure there wasn't something different there and there wasn't.

    Any idea why 1 form would work and the other would show #Error when the massage fee was blank?

  4. #4
    Jojojo is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2011
    Posts
    46
    SOLVED!

    I had a thought as soon as I posted that last reply - The names of my fields were wrong. They were Text 17 etc instead of Sales Tax etc.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Total for Row
    By kwooten in forum Reports
    Replies: 7
    Last Post: 08-31-2011, 01:51 PM
  2. Total's Box
    By Bike in forum Forms
    Replies: 1
    Last Post: 03-31-2011, 12:15 PM
  3. Various Day Calculation Function
    By access_tom in forum Access
    Replies: 6
    Last Post: 10-13-2010, 02:37 PM
  4. total many fields by function
    By thetuyen in forum Access
    Replies: 2
    Last Post: 03-08-2010, 08:43 PM
  5. Want function to get current function name
    By Davis DeBard in forum Programming
    Replies: 2
    Last Post: 08-13-2009, 05:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums