Where to put"nz" in a formula in an Access query?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Teresa Barnacle
    New Member
    • Jan 2011
    • 10

    Where to put"nz" in a formula in an Access query?

    Need help again,sorry

    B: IIf([Miles]>150,130*3.8,II f([Miles]>19.9 And [Miles]<150.1,([Miles]-20)*3.8))

    How do I put in this "if null put me a 0 in" ?

    My other sums don't work if I don't put a zero in, sometimes I could scream !

    Regards, Teresa
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    I don't mean to sound rude but have you tried the helpfile on the nz function?

    Anyways since [Miles]is the only thing that can be null, thats the part you want to check for. So around the [Miles] you could put:
    Code:
    Nz([Miles],0)

    Comment

    • Teresa Barnacle
      New Member
      • Jan 2011
      • 10

      #3
      Thanks I will give it a go.

      I did try the Microsoft help file with nz, but the explanation went way over my head !

      Comment

      • Teresa Barnacle
        New Member
        • Jan 2011
        • 10

        #4
        No, couldn't get that to work.

        If it was a simply Nz([Miles], 0) I could do, but there are to many ( [ for me to work out where the nz's go !

        Help !

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32662

          #5
          Teresa, this is good thinking, but on balance for this formula I'd go with ADezii's idea of using IsNull() just the once, rather than Nz() three times. You'll find the proposed solutions in the other thread - Excel Formula into an Access Query.

          Comment

          Working...