Results 1 to 7 of 7
  1. #1
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Twosome Query becomes treesome (Access2003)

    I wrote 2 queries that are pulling data by criteria. I had made those 2 as union query and it is produces wonderful Report.
    Client Name and number are fields those are unioned by.
    I was just asked to add criteria #3 and I am thinking now if I can union 3rd query somehow by same fields.
    Example would be

    Client Name Client Number Category
    A 1 P
    A 1 D
    A 1 I
    B 2 P
    B 2 D
    B 2 I

    So there ia a Query for P, for D and for I.


    Thanks
    A

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Twosome Query becomes treesome (Access2003)

    You can combine any number (almost) of queries in a union query, but it seems to me you don't really need a union query for this. You could create a normal query, with the following in the criteria line for Category:

    In ("P", "D", "I")

  3. #3
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Twosome Query becomes treesome (Access2003)

    See, those 3 queries aren't based on the same tables. Let say QueryP contains 4 tables plus Table with P value.
    QueryD contains 4 tables as QueryP plus Table with D value. QueryI contains 4 tables as QueryD plus Table with I value.

    So I am trying to union those but it saying number of columns are not the same which isn't the truth...any thoughts?
    Thanks

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Twosome Query becomes treesome (Access2003)

    Can you post the SQL of your union query?

  5. #5
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Twosome Query becomes treesome (Access2003)

    SELECT *
    FROM Query1

    UNION SELECT *
    FROM Query2, QueryAsteric
    ORDER BY Name, Type_NBR;

    It worked well before I added QueryAsteric...

    Thanks

  6. #6
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Twosome Query becomes treesome (Access2003)

    When I am executing Query1 and Query2 - it works, Query1 and QueryAsteric - it works - all 3 - columns do not match!
    1 and 2 match
    1 and Asteric match
    1,2,Asteric no match...

  7. #7
    5 Star Lounger
    Join Date
    Jan 2005
    Posts
    614
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Twosome Query becomes treesome (Access2003)

    I got it, I got it!!!

    It was a wrong syntax...I had never used 3 in one before.

    Thanks a lot

Posting Permissions

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