Results 1 to 12 of 12
  1. #1
    vbpeterson is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Aug 2011
    Posts
    14

    If/Then Null based on Null Value of Another Field

    HELP PLEASE!!



    I am having trouble creating an expression whereby the value of [ThisExpr] is conditioned upon whether (NZ[OtherExpr]) is Null. So, If (NZ[OtherExpr]) returns a null value then 0, or If [OtherExpr] is not Null then [ThisExpr].

    Hope that makes sense.

    Thank you, Kim

    PS I am running Access 2007, not 2003 as shown above.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I think you have some misunderstanding of the NZ() function.
    For examples see
    http://www.techonthenet.com/access/f...dvanced/nz.php

  3. #3
    vbpeterson is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    14
    "NZ[OtherExpr]" was just my way of trying to represent the "other expression field" in which I used the NZ function. The expressions are actually shown as below. Thank you

    NewAssessedValue: (NZ([PropertyNewAppraisedValue],0)*0.4)

    NewTaxAmount: ([NewAssessedValue]*[MilageRate])

    TaxSavings: ([OriginalTaxAmount]-[NewTaxAmount])

    I need the value for TaxSavings to be 0 when the value for NewAssessedValue is 0.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    My first thought is to adjust NewAssedValue as


    NewAssessedValue: iif(NZ([PropertyNewAppraisedValue],0)= 0,0,[PropertyNewAppraisedValue]*0.4)

    This is saying
    If the [PropertyNewAppraisedValue] is NULL, give me a 0, so
    if [PropertyNewAppraisedValue] =0 then NewAssessedValue will be 0

    if [PropertyNewAppraisedValue] <>0 then NewAssessedValue will be [PropertyNewAppraisedValue]*0.4

  5. #5
    vbpeterson is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    14
    That makes sense. However, it doesn't solve my Tax Savings calucation issue. If PropertyNewAppraisedValue is 0 and NewAssessedValue is 0 I will still get a TaxSavings value based on OrigTaxAmt-NewTaxAmt. I need Tax Savings to be 0 if PropertyNewAppraisedValue has not been entered yet.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Hmmm....
    TaxSavings: ([OriginalTaxAmount]-[NewTaxAmount]) 'Your original

    TaxSavings: ([OriginalTaxAmount]-([NewAssessedValue]*[MilageRate]) 'Substituting NewTaxAmount


    and substituting NewAssessedValue
    TaxSavings: ([OriginalTaxAmount]-(iif(NZ([PropertyNewAppraisedValue],0)= 0,0,[PropertyNewAppraisedValue]*0.4)*[MilageRate])

    I think TaxSavings as a calculation holds true. I'm not sure where "if PropertyNewAppraisedValue has not been entered yet" fits.

    If it hasn't been entered, does that mean it's NULL, so NZ(...,0) will be 0 and the calculation in red will be 0, so Tax Savings will be the OriginalTaxAmount - 0.

  7. #7
    vbpeterson is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    14
    "If it hasn't been entered, does that mean it's NULL, so NZ(...,0) will be 0 and the calculation in red will be 0, so Tax Savings will be the OriginalTaxAmount - 0. "

    Exactly, and that is the problem. If the New Appraised Value has not been entered yet I need the tax savings to be 0, not OrigTaxAmt - 0.

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Part of the issue I'm seeing is that you don't have a mathematical expression. You have calculated fields, and those are dependent on someone having entered something.

    So iif(NZ([PropertyNewAppraisedValue],0)= 0 then OriginalTaxAmount means nothing, so set it to 0


    (A)OriginalTaxAmount =iif(NZ([PropertyNewAppraisedValue],0)= 0 ,0,OriginalTaxAmount)

    TaxSavings=
    ([OriginalTaxAmount]-[NewTaxAmount]) and the whole thing comes down to

    taxsavings = originalTaxAmount - newTaxAmount which becomes

    TaxSavings = iif(NZ([PropertyNewAppraisedValue],0)= 0 ,0,OriginalTaxAmount) - (iif(NZ([PropertyNewAppraisedValue],0)= 0,0,[PropertyNewAppraisedValue]*0.4)*[MilageRate])


    I just strung the pieces together.

  9. #9
    vbpeterson is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    14
    This calulation is meant to show how much is saved (the difference) in property taxes after a property value appeal. There is an OriginalAppraisedValue field which will always have a value input. From that value the OriginalTaxAmount is calculated. So there is always an OriginalTaxAmount, not 0. The NewAppraisedValue is not input until after the tax appeal. So, as it is written now, when the fields are calculated before the NewAppraisedValue is input the TaxSavings is as you said, OriginalTaxAmount - NewTaxAmount, since the NewTaxAmount at this time is 0 the answer is the same as OriginalTaxAmount, which is incorrect because having the answer the same as the OriginalTaxAmount is not how much will be saved (the difference between the original and new tax amount). I need the Tax Savings to be 0 until a value is input in the NewAppraisedValue field.

    I hope that makes sense. I appreciate your help. Please stick with me

  10. #10
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Did you try the set up in the post I sent?

  11. #11
    vbpeterson is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    14
    I have put it your setup and am testing. Must run some errands, be back later this evening. Thank you so much.

  12. #12
    vbpeterson is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2011
    Posts
    14
    Dear orange, So sorry for not getting back to you sooner. I haven't been able to get back to working out this problem until today. Other priorities getting in the way. Your fix worked perfectly! Of course THank you very much for your help.

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

Similar Threads

  1. Replies: 1
    Last Post: 02-23-2012, 02:27 PM
  2. Finding the Max Date and Null Values if Null
    By SpdRacerX in forum Queries
    Replies: 1
    Last Post: 02-03-2012, 06:29 AM
  3. Null field message
    By jpkeller55 in forum Access
    Replies: 3
    Last Post: 09-03-2010, 10:45 AM
  4. If Form Field is not null then...
    By cotri in forum Forms
    Replies: 5
    Last Post: 01-12-2010, 11:08 AM
  5. Query returns null..based on two tables
    By shsh_shah in forum Queries
    Replies: 1
    Last Post: 03-08-2009, 01:45 PM

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