Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Sydney, New South Wales, Australia
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Multiple Select query (97/SR2)

    Sorry about the length of this but pls bear with me.

    I am having trouble constructing the criteria for a query. The criteria is
    based on a combo box on a main menu. The options in the combo are:
    <All>,Marketing,Admin,Sales,HR,Accounts,Maintenanc e. If I select <All>, I
    want all records returned, if I select Admin, I want to see Admin records
    only, the same for Accounts. However, if I select Marketing, I want to see
    Marketing and Sales records, and if I select HR, I want to see HR and
    Maintenance records.

    I feel I can't get past first base on this because if I try this:

    IN("Marketing","Sales")

    it works.

    If I try

    Iif(Forms![frmMenuForm]![Dept]="Marketing",In("Marketing","Sales"),"blah
    blah blah")

    I get an error msg: the query is too complex etc

    Can someone help me with a neat criteria for all that I want to achieve?

    Thanks in advance.

  2. #2
    Star Lounger
    Join Date
    Dec 2001
    Location
    Fredensborg, Denmark
    Posts
    86
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Multiple Select query (97/SR2)

    In your query type in the criteria for Dept on consecutive rows like this:
    "Admin"
    "Accounts"
    In("Marketing","Sales")
    In("HR","Maintenance")
    Like "*"

    In a new column of your query type:
    Combo:Forms![frmMenuForm]![Dept]

    In Combo's criteria type (consecutive rows):
    "Admin"
    "Accounts"
    "Marketing"
    "HR"
    "<All>"

    That's all. Hope you find this helpfull.

  3. #3
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Sydney, New South Wales, Australia
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Multiple Select query (97/SR2)

    Brilliant! It works perfectly.

    Thank you.

    Is there any one reference book which lists 'tricks' like these?

    Nick

Posting Permissions

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