Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2015
    Posts
    1

    Unhappy Unanswered: Iif in query question

    Hi,

    I want to filter a query based on a date control in a form. If the control selects today, I was the query to filter on all days before and including today. If the control selects any other day, I want the query to select only the chosen day.

    I thought that this would work:

    Iif([Forms]![Line 1]![Day select]=Date(),<=Date(),[Forms]![Line 1]![Day select])

    It doesn't. When today is selected, it returns no entries. When any other day is selected, it functions as desired.

    Any help would be hugely appreciated.

    Thanks

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    Remove the = date

    Iif([Forms]![Line 1]![Day select]<=Date(),date,[Forms]![Line 1]![Day select])

  3. #3
    Join Date
    Jan 2009
    Location
    Kerala, India
    Posts
    183
    Iif([Forms]![Line 1]![Day select]=Date(),<=Date(),[Forms]![Line 1]![Day select])
    The above statement should work, but try changing it to:

    Code:
    Iif([Forms]![Line 1]![Day select]=Date(),<=[Forms]![Line 1]![Day select],[Forms]![Line 1]![Day select])
    www.MsAccessTips.com (Learn MS-Access Tips & Tricks)
    Learn Advanced MS-Access Programming with sample VBA Code.

    All responses are based on Access 2003/2007

Posting Permissions

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