Results 1 to 6 of 6

Combine Multiple Fields with repeats

  1. #1
    millzner is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2019
    Posts
    2

    Combine Multiple Fields with repeats


    Hello - I am trying to combine 2 fields into one from 2 different tables and make a new table which is easy enough....but Table 1 would have 5 Records (field values would be A, B, C, D, E) and Table 2 would have 50 Records (1,2,3,4,5,6.....50). I want to do a make table combining the 2 records but results would have 250 records. New Field would be (A-1, A-2, A-3, A-4, A-5....A-50, B-1, B-2, B-3, B-4.....B-50, C-1,C-2....)

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,726
    Create a query that includes both tables but without a join between them. You'll get what I think you want, which is a Cartesian product.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,842
    If you do a Cartesian Product between the two tables, you will get the 250 records, by default. Simply include both tables, with no join between the two, and it will do this for you automatically, i.e.
    Code:
    SELECT Table1.Field1, Table2.Field1
    FROM Table1, Table2;

    EDIT: Too slow! In the amount of time it has taken me to type this up, it looks like Paul has already responded!
    Using Access 2007
    Proficient in Access, Excel, VBA, and SQL

  4. #4
    millzner is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2019
    Posts
    2
    Thanks JoeM and pbaldy.....that will work....new I was over thinking it.

  5. #5
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,726
    Quote Originally Posted by JoeM View Post
    EDIT: Too slow! If the amount of time it has taken me to type this up, it looks like Paul has already responded!
    It's morning here and the house hasn't warmed up yet. I have to type fast to generate heat.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,842
    It's morning here and the house hasn't warmed up yet. I have to type fast to generate heat.
    And despite my slowness, I am still susceptible to typos!!!
    (should be "In the amount of time...)
    Using Access 2007
    Proficient in Access, Excel, VBA, and SQL

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

Similar Threads

  1. Combine multiple fields into one
    By rpyee15 in forum Access
    Replies: 1
    Last Post: 05-09-2016, 08:31 AM
  2. Replies: 3
    Last Post: 05-29-2014, 09:50 AM
  3. Replies: 13
    Last Post: 06-21-2012, 09:03 AM
  4. Combine values from multiple fields
    By jsimard in forum Queries
    Replies: 8
    Last Post: 06-09-2011, 01:05 PM
  5. Replies: 3
    Last Post: 12-14-2010, 08: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
  •  
Tech Forums: Microsoft Office Forums