Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Feb 2012
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    combine date if conditions are met

    I tried some code like this in a query using IIf
    If [StartDate] = [EndDate], Then just print [StartDate], else [StartDate] "thru" [EndDate]
    It just displays a null field.

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts
    If your StartDate is null, the result will be null. Assuming it isn't null, this should work:

    IIF([StartDate]=[EndDate],[StartDate],[StartDate] & " thru " & [EndDate])
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    New Lounger
    Join Date
    Feb 2012
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    using the IIF formula

    I tried that formula. However, only the true part works, ie Start date.
    what does not work is the false part. for some reason it displays nothing. Seems it is being confused by 2 date fields and the "thru"
    paul

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts
    Well, I don't know what to tell you. I tried it on a table I had, and it worked perfectly.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  5. #5
    New Lounger
    Join Date
    Feb 2012
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    me too

    I just tried it on another databse and it worked as well. thanks for the help

Posting Permissions

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