Results 1 to 4 of 4
  1. #1
    lomiA is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2015
    Posts
    2

    RE: Problem with IIf statements in Query Criteria (Access 2007)

    I have a problem with setting up IIf statement in Query criteria:



    I have an Access 2007 database and I am trying to retrieve a list of addresses depending on the letter "X" in the month fields. Each address has the letter X in either all the months or quarterly.

    The following is the list of fields in my table:
    ID Address Jan Feb Mar Apr Jun Jul Aug Sep Oct Nov Dec

    Also, I have a form(FR_Search) with combo box(month) to select the month and run a query to retrieve the addresses with "X" under the selected month.

    So, I created a query and under month field for e.g Jan field, I entered: IIf([forms]![FR_Search]![month]="JAN","X","") and this works for January only, but when I added similar IIf statements to other months, the query for January no longer works.

    I am very new to Access. if anyone could help out, I would appreciate it very much. If you have any alternative solutions that would be great as well.

    Thank you.
    Lomi

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,945
    This data structure is not normalized and will cause you all kinds of frustration, this is only the first.

    Each criteria must be on a separate criteria row to invoke the OR operator.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    lomiA is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2015
    Posts
    2
    Quote Originally Posted by June7 View Post
    This data structure is not normalized and will cause you all kinds of frustration, this is only the first.

    Each criteria must be on a separate criteria row to invoke the OR operator.
    Thank you for your reply. But, how do you normalized the data structure that I have right now?

  4. #4
    LaughingBull is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Toledo Ohio
    Posts
    143

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query Criteria Using IIf Statements
    By MintChipMadness in forum Queries
    Replies: 6
    Last Post: 01-26-2013, 06:55 PM
  2. access 2007 query problem
    By jassie in forum Queries
    Replies: 1
    Last Post: 03-14-2012, 04:21 PM
  3. query criteria in access 2007
    By jeskit in forum Access
    Replies: 2
    Last Post: 11-23-2011, 06:44 AM
  4. Replies: 2
    Last Post: 06-18-2011, 09:55 AM
  5. Replies: 1
    Last Post: 03-29-2010, 10:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums