Results 1 to 2 of 2
  1. #1
    bigchicagobob is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    18

    Single Table Query, Pulling multiple fields each with specific criteria.

    Hi all,

    I am attempting to pull multiple fields from a single table. I need to pull any data that has the following:

    [ShipCode]= "code1" "code4" or "code5"
    Of those three codes, with an [estimate]="E" and a [flag]="p" and [DueDate] within 5 days before yesterday.



    When I attempt to use the code below I receive...

    Code:
    Unconfirmed: IIf([ShipCode]="code1" Or [ShipCode]="code4" Or [ShipCode]="code5" And [Estimate]="E" And [Flag]="P" And [Due Date]<=(Date()+4),"Not Confirmed",Null)
    This results in the correct ship codes of only [ship code]= "code1" "code4" or "code5" showing... but i get a whole assortment of values from the [estimate] field, [flag] field, and [due date] field.

    I am using MS Access 2010 on windows 7. Thank you,

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You need parenthsis around the "OR" values : ([ShipCode]="code1" Or [ShipCode]="code4" Or [ShipCode]="code5")

    Try:
    Code:
    Unconfirmed: IIf(([ShipCode]="code1" Or [ShipCode]="code4" Or [ShipCode]="code5") And [Estimate]="E" And [Flag]="P" And [Due Date]<=(Date()+4),"Not Confirmed",Null)

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

Similar Threads

  1. Replies: 11
    Last Post: 04-22-2013, 04:21 PM
  2. Replies: 11
    Last Post: 11-12-2012, 06:33 AM
  3. Replies: 3
    Last Post: 06-07-2012, 07:06 AM
  4. Replies: 1
    Last Post: 11-10-2011, 08:07 PM
  5. Replies: 1
    Last Post: 08-30-2011, 07:35 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