Results 1 to 9 of 9
  1. #1
    topcat10 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    5

    Merge Data Tables

    Hi all,



    I have two tables of similar structure.

    The first table is to be used by staff. Fields are; Transaction ID, Transaction Date, Food Item, Food Price, Quantity, Food Points, Total Points, Staff Member.

    The second table is to be used by supervisors. Fields are exactly the same as above.

    I need to merge the two tables together so that I can pull off a report for all transactions put through by staff and supervisors.

    How do I go about this?

    Many thanks in advance!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,640
    Use a UNION query. There is no wizard or designer for UNION. Must type in SQL View of query builder.

    Why are there two tables? Why not one? Could have another field to distinguish the two groups of records for filtering and sorting.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    If [Transaction ID] is an autonumber, then you will have to make some changes.
    make a new field on both tables [OldTransID]
    run update query to upd
    [OldTransID] from [Transaction ID]

    run a make table query from STAFF tbl (but dont bring in [TransactionID]
    run an append table to the new table from SUPERVISORS table. (again
    dont bring in [TransactionID]
    create a new field call: [TransactionID] as autonumber

    done


  4. #4
    topcat10 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    5
    Thanks ranman256. This is very helpful!

    I am having some problems though when I am creating my make table query.

    Some of the fields are calculated, and I am getting the error message "Calculated Columns are not allowed in SELECT INTO statements"

    Any ideas on how to cross this bridge?

    Many thanks!

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,640
    Don't select those fields for make table and will have to manually recreate the calculated fields after table is built.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    topcat10 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    5
    Thanks for all your help so far guys, it is much appreciated!

    When I try and run my append query I am getting the error message 'Microsoft Access can't append all the records in the append query'.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,640
    Post your query statement for analysis.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    topcat10 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jul 2015
    Posts
    5
    INSERT INTO tblMakeTableqry ( [Transaction Date], DrinkItem, DrinkPrice, StaffMember, Quantity, DrinkPoints1, Promotion, CarryPoints )
    SELECT tblDrinkUpsellRecordsSupervisor.[Transaction Date], tblDrinkUpsellRecordsSupervisor.DrinkItem, tblDrinkUpsellRecordsSupervisor.DrinkPrice, tblDrinkUpsellRecordsSupervisor.StaffMember, tblDrinkUpsellRecordsSupervisor.Quantity, tblDrinkUpsellRecordsSupervisor.DrinkPoints1, tblDrinkUpsellRecordsSupervisor.Promotion, tblDrinkUpsellRecordsSupervisor.CarryPoints
    FROM tblDrinkUpsellRecordsSupervisor;

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,640
    Syntax looks good. Must be an issue with data.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Merge Tables
    By cfobare79 in forum Access
    Replies: 21
    Last Post: 05-02-2015, 03:53 PM
  2. how to merge two or more tables horizontally with vba?
    By registoni in forum Programming
    Replies: 2
    Last Post: 09-20-2013, 06:43 AM
  3. Don't know if I should merge tables (please help)
    By bigdaddy757 in forum Database Design
    Replies: 2
    Last Post: 05-30-2013, 01:52 PM
  4. Mail Merge w/ data from 2 tables
    By sedain121 in forum Import/Export Data
    Replies: 3
    Last Post: 06-30-2010, 09:43 AM
  5. How do I Merge Four Tables Together
    By SteveI in forum Queries
    Replies: 1
    Last Post: 03-04-2010, 10:53 AM

Tags for this Thread

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