Results 1 to 5 of 5
  1. #1
    todavy is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    6

    Merging 2 tables

    I have an Access 2007 table with two fields, ProductName and ProductSort:


    ProductName / ProductSort
    juice / cool
    juice / tropical
    juice / natural
    cola / cool
    cola / artificial

    And I want it to become like this:



    ProductSum
    juice, cool, tropical, natural
    cola, cool, artificial
    ..etc

    In other words, the ProductName field should be merged with the ProductSort field to a new textfield called ProductSum with ProductName and all related ProductSorts separated with commas (one uniqe product per row).

    Is this possible by using a Query? If not how?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I believe you should find this link helpful.

  3. #3
    todavy is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    6

    Another way?

    I was afraid of going into the VB code. But isn't it possible to solve this way?

    From this table:

    ProductName / ProductSort
    juice / cool
    juice / tropical
    juice / natural
    cola / cool
    cola / artificial

    To a new table:

    ProductName / ProductSort1 / ProductSort2 / ProductSort3 / [etc...]
    juice / cool / tropical / natural
    cola / cool / artificial

    And then concat the fields with a "&" sign to a new table. Or am I out in the ozon here...

  4. #4
    todavy is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    6

    A little more explanation..

    I have "productcategories" on the "many"-side of a one-to-many relationship (actually there's a junction table between the products- and categories table that makes it possible for one product to belong to many categories and vice versa).

    The trick is that, from the constallation above, make a .csv file (textfile) with this design:

    category1@category@category2 [etc..], productId, price, weight [etc..]

    Where the "@" (at) sign separates the productcategories and the "," (comma) sign separates the other product info.

    I can't change the design of the .csv file. I'm using that to upload product to a webshop (Wosbee.com) and it has to be in that format.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I do not know how to accomplish what you want without using code. Why are you reluctant to use code?

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

Similar Threads

  1. Replies: 8
    Last Post: 11-04-2009, 04:22 AM
  2. Merging
    By bailey537 in forum Queries
    Replies: 0
    Last Post: 07-14-2009, 04:14 AM
  3. Merging values in Access
    By jains in forum Forms
    Replies: 0
    Last Post: 06-08-2009, 09:31 PM
  4. Joining tables two tables and another table that is not
    By DevintheDude in forum Database Design
    Replies: 0
    Last Post: 09-12-2007, 08:56 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