0

I have been all over the internet trying to find a solution to this but for the life of me I cant get my head around it.

I have 3 sets of data in Excel, we will call them (old, new, other) they all contain the same columns headers. The information is routing data for manifactoring process. E.g. to make stock item 21632 we do the following:

<table class="tableizer-table">
<thead><tr class="tableizer-firstrow"><th>Part No.</th><th>Op. No.</th><th>Operation Name</th><th>Real Op Time Per Item</th><th>Resource Group</th><th>Setup Time</th></tr></thead><tbody>
 <tr><td>21632</td><td>10</td><td>Issue Mat'l</td><td>15</td><td>STORES</td><td>0</td></tr>
 <tr><td>21632</td><td>20</td><td>Rough out and part off</td><td>210</td><td>3/C4</td><td>90</td></tr>
 <tr><td>21632</td><td>30</td><td>Finish M/c</td><td>90</td><td>CNCLAT LC3</td><td>90</td></tr>
 <tr><td>21632</td><td>40</td><td>Inspect</td><td>5</td><td>INSPECT</td><td>0</td></tr>
 <tr><td>21632</td><td>45</td><td>NDE </td><td>40</td><td>NDE</td><td>0</td></tr>
 <tr><td>21632</td><td>50</td><td>MARK</td><td>10</td><td>MARK</td><td>5</td></tr>
 <tr><td>21632</td><td>70</td><td>Final inspection</td><td>7</td><td>INSPECT</td><td>0</td></tr>
</tbody></table>

The 3 spreadsheets have about 20k lines in each and I wanted to merge/overwrite them New > Other > Old by row by the PSTK column (Each PSTK will appear multiple times).

I have imported all the data into Access into 3 tables to try to Run some SQL on them.

I tried running union on them: select * from Old union select * from New, but it just merges everything as the data along the row may differ.

Trying to simplify what I want to do is:

Merge/overwrite the OLD table with the NEW table. If any of the PSTK in the NEW table appear in the OLD table I want to overwrite the whole row from the NEW table. If it does not appear I just want to add it.

I hope this makes sence.

Table info: OLD, NEW, OTHER Column Headings:(ID),line,pstk,Setup Time,runt,desc1,ml_type

jarlh
  • 42,561
  • 8
  • 45
  • 63
Tim
  • 1

1 Answers1

0

You can run a combined append/update query:

Update and Append Records with One Query

When new data arrives, just run the query again.

Gustav
  • 53,498
  • 7
  • 29
  • 55