Results 1 to 5 of 5
  1. #1
    thegooser is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    16

    Multiple Queries With Same Type Of Data

    I have multiple queries containing the same types of data.



    How would I make one big query out of all of this data?

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    If all the fields in your queries have the same fields [with the same data types] in the same order . . .
    You can create a 'Union Query' that combines all the data into one data set.

    What I do if I want to see ALL the data from all the queries in one data set:
    I open each query in SQL View and copy the SQL into a new query and put 'UNION ALL' on a new line except after the last query.
    It will look something like this:
    Select Field1, Field2, field 3 From Table1 where . . .
    UNION ALL
    Select Field1, Field2, field 3 From Table2 where . . .
    UNION ALL
    Select Field1, Field2, field 3 From Table3 where . . .
    UNION ALL
    Select Field1, Field2, field 3 From Table4 where . . .;
    The field names don't have to be the same - just the order and the type of data [because otherwise you might be attempting to put Text, Date and Currency [different types of data] in the same column of the query . . .

    Let us know if you need more help!

  3. #3
    thegooser is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    16
    Quote Originally Posted by Robeen View Post
    If all the fields in your queries have the same fields [with the same data types] in the same order . . .
    You can create a 'Union Query' that combines all the data into one data set.

    What I do if I want to see ALL the data from all the queries in one data set:
    I open each query in SQL View and copy the SQL into a new query and put 'UNION ALL' on a new line except after the last query.
    It will look something like this:
    Select Field1, Field2, field 3 From Table1 where . . .
    UNION ALL
    Select Field1, Field2, field 3 From Table2 where . . .
    UNION ALL
    Select Field1, Field2, field 3 From Table3 where . . .
    UNION ALL
    Select Field1, Field2, field 3 From Table4 where . . .;
    The field names don't have to be the same - just the order and the type of data [because otherwise you might be attempting to put Text, Date and Currency [different types of data] in the same column of the query . . .

    Let us know if you need more help!
    OK that worked, however this is giving me another problem. I figure it must be down to this as I have eliminated everything else.

    When this produces a union table, I create a query from it.

    So now I have a query of all of the date using the above code.

    When I try to link this to excel, it says there are "too many parameters". Do you know how this could be?

  4. #4
    thegooser is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    16
    I'm really sorry to incorrectly tarnish your great name.... I was wrong and your help that you gave me worked fine. It is a completley different slice of code that is buggering up the link to excel.

    For every import from the csv files I made a query. At the end of each query I put : Filename: "NAME OF THE FILE" so it added an extra field naming the source. This is what is messing with the link. Does anyone know any way to fix this???

  5. #5
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    No problem . . . especially as I don't have a great name to tarnish!!

    I'm still learning and I think the real gurus here know that!

    It might be a good idea to mark this thread 'Solved' [Thread Tools . . . above] & start a new thread with your new issue.
    There is a better chance that more people will look at your question if there are no replies.

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

Similar Threads

  1. Set default export file type for queries
    By Lady_Jane in forum Import/Export Data
    Replies: 1
    Last Post: 03-29-2012, 04:53 PM
  2. Help: queries or forms and which type?
    By phineas629 in forum Access
    Replies: 11
    Last Post: 10-10-2011, 08:40 AM
  3. If __ Then __ type commands in queries?
    By TUPJK in forum Access
    Replies: 7
    Last Post: 06-20-2011, 01:28 PM
  4. Data type mismatch error on all of my queries!
    By MarkGLyons in forum Queries
    Replies: 3
    Last Post: 12-27-2010, 01:27 PM
  5. Replies: 2
    Last Post: 03-18-2010, 08:24 PM

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