Results 1 to 3 of 3
  1. #1
    David_ is offline Novice
    Windows 11 Office 365
    Join Date
    Oct 2022
    Posts
    2

    How can I merge the columns from two tables into a new table. Also would like this automated.

    I have a request that I posted earlier today in Stack Overflow, and it is still plaguing me. I hope someone here can assist. Cheers in advance!

    I receive assay values from multiple laboratories.
    I import them all into a mass Access table called "sample". within this "sample" are dozens of headers that allow for the collation of information that is newly imported, and also significant legacy values. For example:

    Si_% Si_pct Si_ppm Si_ppb Au_% Au_pct Au_ppm Au_ppb
    7 63 0.063 0.5 500 0.5

    (with values beneath the headers. Some are null spaces due to different requirements for previous or new laboratory assays)



    I wish to clean up the data with a new table that automatically updates imported values from the bulk "sample" table, into separate tables that streamline the headers.

    I want the new tables to be called "samples_%", "samples_ppm", samples_ppb" etc. With the index ID also coming across.

    I then wish to automate this process in a macro after each import from the laboratory .csv / .xlsx such that when the "sample" has been updated, running the macro will automatically update these new tables also. Can anyone help?

    I have tried to generate queries that would assist but I fee I am heading down the wrong track (see below fail).






    EDIT - I have been informed within the aforementioned stack-overflow exchange that the use of symbols can cause me some grief. As such I am happy to have the new tables titles "samples_pct", "Samples_ppm", etc

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Are both of those ID fields autonumber type? Makes no sense to link 2 autonumber fields.

    Your data structure is more like a spreadsheet (short and wide) instead of a relational database (long and narrow). If you maintain the tests as sets of fields, really no advantage to splitting into separate tables, unless you are hitting 255 fields.

    Normalized structure would be more like:

    SampleID SampleDate ProjectID_FK
    1 1/1/2022 4
    2 2/1/2022 4

    SampleID_FK Test Pt Pct Ppm Ppb
    1 Si 7 63 0.063 0.5
    1 Au 500 0.5
    2 Si 5
    2 Au 400
    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
    David_ is offline Novice
    Windows 11 Office 365
    Join Date
    Oct 2022
    Posts
    2
    Quote Originally Posted by June7 View Post
    Are both of those ID fields autonumber type? Makes no sense to link 2 autonumber fields.
    Yes, the ID's are generated automatically upon importing the new laboratory results.
    Really? I was under the impression (when I was working on that query) that I needed to indicate an index for both tables and to specify the values that matched... in retrospect what you say does make sense.

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

Similar Threads

  1. Merge 8 tables with like fields into a single table
    By GraeagleBill in forum Access
    Replies: 9
    Last Post: 03-31-2022, 05:02 PM
  2. Replies: 4
    Last Post: 03-25-2019, 10:46 AM
  3. Automated Email / Mail Merge
    By kazaccess in forum Access
    Replies: 17
    Last Post: 01-13-2014, 12:02 AM
  4. Replies: 1
    Last Post: 05-21-2013, 12:02 PM
  5. Automated Mail Merge
    By celinae in forum Programming
    Replies: 1
    Last Post: 09-20-2010, 09:57 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