Results 1 to 5 of 5
  1. #1
    Join Date
    May 2004
    Posts
    15

    Unanswered: =Sum((IIf.......how to make textbox 0 if nothing

    I have a continuous form that displays a list of reservations, waitlist, and cancelled. And the list does not allow additions. Can only add a reservation by a command button.

    I have a textbox that displays the total # of reservations by the control source

    =Sum(IIf([status]="Reserved" , 1, 0))

    If I open a list that has no information or no one has called to reserve, cancel, or waitlist, i want to be able to have my total # of reservations to display 0 instead of blank or Null. Pretty much I would like my textbox to have a value no matter what.
    Anyway I can do this?
    Last edited by x7tristan; 05-17-04 at 11:33.

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    =nz(Sum(IIf([status]="Reserved" , 1, 0)), 0)
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557
    Might I ask what the nz() does? I have seen this alot recently and I would like to learn. What does it do?!

    JS
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    nz() accepts two arguments, the first argument is a field or value to be evaluated, the second is the value to return if the first argument is null.

    So:

    nz((Sum(IIf([status]="Reserved" , 1, 0)), 0)

    will return 0 if the sum() function returns null.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  5. #5
    Join Date
    May 2004
    Posts
    15
    Thanks teddy

    you accesss monkey

Posting Permissions

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