Results 1 to 10 of 10
  1. #1
    deepakes2 is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2016
    Posts
    18

    how can we do the following . Thanks for ur help

    Hello : Some one please help me get this output.

    Table 1 :

    Username location gender


    Table 2:



    Username location gender age

    Table 3:

    Username location gender ID


    output

    Table1 username location gender
    Table2 username location gender age
    Table3 username location gender __ ID

    Plz let me know if you have any questions. Please help me get a similar output. I have the data in different tables in access DB . i have to merge the tables into one table.
    Last edited by deepakes2; 02-09-2017 at 02:43 PM. Reason: accidentally hit enter

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Each table has how many fields? Its unclear from your description

    Tbl1
    username
    location
    Gender

    Are the usernames the same data?

  3. #3
    deepakes2 is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2016
    Posts
    18
    Each table has more than 30 fields which are common and there are few fields ( 2 or 3 ) randomly added to few tables. I need to keep all the records . there may be duplicated usernames.
    Last edited by deepakes2; 02-09-2017 at 03:11 PM. Reason: not a complete answer

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    How about

    SELECT username, location, gender, Null As Age, Null As ID
    FROM Table1
    UNION ALL
    SELECT username, location, gender, Age, Null As ID
    FROM Table2
    UNION ALL
    SELECT username, location, gender, Null As Age, ID
    FROM Table3
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    deepakes,

    What is your situation exactly? Are you designing a database?
    Modifying an existing database?

    Perhaps you could describe what you are trying to accomplish in very simple English.
    Without some context we can only guess and provide very general suggestions.

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    @deepakes,
    And please pick one thread or the other - you have 2 threads going that are the same question.
    https://www.accessforums.net/showthread.php?t=64348
    https://www.accessforums.net/showthread.php?t=63148

  7. #7
    deepakes2 is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2016
    Posts
    18
    I have tables in the access DB . my task is to merge all the tables into one table while indexing the data to know the source table. Each table has around 30 identical fields. some of the tables have additional fields (no specific pattern). Lets not worry about the added fields and just focus on the identical fields.
    I have numerous tables in the DB and I have to perform this on numerous access DB. So i am looking to get some help to create a loop or something .

    Something in the lines of

    n automated way would be something like:

    For i = 1 to 31Docmd.RunSQL "INSERT INTO tbl2015Jan ( ColumnA, ColumnB, ColumnC, TableName )
    SELECT tblJan(i).ColumnA, tblJan(i).ColumnB, tblJan(i).ColumnC, "tblJan(i)"
    FROM tblJan(i)"

    next i

    plz advice. Thanks for looking

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    To get focused advice, you are going to have to do much better than
    "So i am looking to get some help to create a loop or something" .

    Tell us about the tables. Their design. Why do you have so many tables?
    What is the background/source of these tables?

    Post a copy of a couple of tables to highlight the issue/opportunity. It would be helpful to you and readers if you showed us the inputs and a sample of the output you need.
    Good luck

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    It would look like:

    "...FROM tblJan" & i

    Since there's only one, you don't need to specify the table in the SELECT clause, only the FROM clause.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    deepakes2 is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2016
    Posts
    18
    Sorry if i am not able to give all the specific details in the previous posts . I will try to explain best i can . I have various access data bases with around 50 or more tables generated daily basis and sometimes multiple times a day. each data base is created every month. I have multiple access db with tables. each table contains around 30 fields(common fields). My task is to merge all the tables into one table with index to track the data source.I have to create one big table in each access db i have. Please let me know if you have any questions. I am not into programming . i don't have lot of experience with access . Please help me with some kind of a code which can loop and create one big table with index(can be the table name). thanks for looking. I appreciate any help towards this.

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

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