Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Oct 2001
    Location
    Blakeslee, Pennsylvania, USA
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts

    If then Statement in a field (2000)

    I have a field in a form that has this as the control source. =DateDiff("d",[Issue_Date],Now())
    I have a yes/no field named Closed and a Closed_Date Field.

    I would Like to have the above perform this.

    If Closed=No then =DateDiff("d",[Issue_Date],Now()) but if Closed=Yes then =DateDiff("d",[Issue_Date],[Closed_Date])

    Is there a way to do this I can't seem to get the syntax right.

    Thanks

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: If then Statement in a field (2000)

    Try this

    =IIF([Closed]=Yes,DateDiff("d",[Issue_Date],[Closed_Date],DateDiff("d",[Issue_Date],Now())

    The Immediate IF function (IIF)
    has this syntax:

    =IIF(Some test, value if test is true, value is test is false)
    Regards
    John



  3. #3
    Star Lounger
    Join Date
    Oct 2001
    Location
    Blakeslee, Pennsylvania, USA
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: If then Statement in a field (2000)

    Thanks that worked like a charm just missing a parethases........... But got it working.

    Thanks

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: If then Statement in a field (2000)

    Looks like I was missing two closing parentheses


    =IIF([Closed]=Yes,DateDiff("d",[Issue_Date],[Closed_Date]),DateDiff("d",[Issue_Date],Now()))
    Regards
    John



  5. #5
    Star Lounger
    Join Date
    Oct 2001
    Location
    Blakeslee, Pennsylvania, USA
    Posts
    67
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: If then Statement in a field (2000)

    thanks

Posting Permissions

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