Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004
    Location
    Santa Clara, CA
    Posts
    1

    Unanswered: #error in IIF statement

    Maybe a simple question, but I have a calculated field in a subform that sums a field. In my main form I substract that field from another. If there are no records in the sub form it is blank. I get the #error in the main forms calculation. here is my calculation:

    =IIF((nz[subform].Form!calculatedfield])="","0",[MainFrmField]-[subform].Form!calculatedfield])

    Any help qould be appreciated

  2. #2
    Join Date
    Feb 2004
    Posts
    533
    =IIF((nz[subform].Form!calculatedfield])="","0",[MainFrmField]-[subform].Form!calculatedfield])

    It appears that you are applying the 'nz' function incorrectly. Nz returns the value of the expression, or a specified value if the expression is null.

    Should be written like this:

    Nz («expr», «valueifnull»)

    Used in your field:
    =IIF(Nz([subform].Form!calculatedfield],"")="","0",[MainFrmField]-[subform].Form!calculatedfield])


    .
    ~

    Bill

  3. #3
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    Quote Originally Posted by JAM JR
    Maybe a simple question, but I have a calculated field in a subform that sums a field. In my main form I substract that field from another. If there are no records in the sub form it is blank. I get the #error in the main forms calculation. here is my calculation:

    =IIF((nz[subform].Form!calculatedfield])="","0",[MainFrmField]-[subform].Form!calculatedfield])

    Any help qould be appreciated
    JAM JR,

    I just wanted to say "Welcome To The Forum" and hope you find it very useful.

    cya
    BUD

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •