Results 1 to 4 of 4
  1. #1
    Karaline's Avatar
    Karaline is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Jan 2017
    Location
    Just North Of Antartica
    Posts
    38

    Question Form Caculation to Add even with blank Fields is incorrect Please help

    =(Nz[AddQuantity],0*Nz[txtRRate],0)+(Nz[Quantity],0*Nz[txtTRate],0)



    Originally I had =([AddQuantity]*[txtRRate])+([Quantity]*[txtTRate]) and it worked until i entered a docket with a blank Add on field.

    can someone please help recreate this for a form that is sending the calculated cost to the table.

    I cant get the addition to work correctly and it was working the above way without Nz but sometimes the AddOn is not required and this caused the calculation not to work. I am trying to fix it but it just keeps saying I have an opera without an operator.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,523
    =Nz([AddQuantity]) * nz([txtRRate]) + ( nz([Quantity]) * nz([txtTRate]) )

  3. #3
    Karaline's Avatar
    Karaline is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Jan 2017
    Location
    Just North Of Antartica
    Posts
    38
    Thanks in advance,
    It looks as if i was over parenthesising yes I am australian, we don't use z's
    and I added 0's where they weren't needed.
    can i ask why no "0"? is there special circumstances where you add the ",0" onto calculation?

  4. #4
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,784
    If the parameter is not provided, the default is either a zero or zero length string. In a case where more than one data type could be returned as a default, I would not omit specifying which I wanted as a safe guard. Not that it's wrong I guess, but why open that door if you don't have to?

    You weren't over doing it. You had them in the wrong places. For most built in functions, what follows the function name must be enclosed. One exception would be Date().
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 7
    Last Post: 10-13-2016, 12:32 PM
  2. Replies: 14
    Last Post: 05-01-2015, 10:36 AM
  3. How to see if all fields of the form are blank.
    By behnam in forum Programming
    Replies: 5
    Last Post: 06-07-2014, 10:21 AM
  4. Replies: 5
    Last Post: 06-11-2012, 08:47 AM
  5. Replies: 2
    Last Post: 02-03-2011, 12:41 PM

Tags for this Thread

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