appending data

  • Thread starter Thread starter macnero
  • Start date Start date
M

macnero

Guest
Hi,

I have a table with data I want to append to another table. The new table (table 2) contains updated records from the original table (table 1). I need to run a query which will use the table 2 to extract the corresponding data from the original table 1 so I can delete the records and append the new records (I dont want to duplicate records). I can query the records using certain fields, ie field1, field2 which will distinguish the records. I've tried a union but need more help.

thanks
 
You have two tables.

Presumably , you want to delete any records in table 1 that have corresponding entries in table 2, then append the records from table 2 to table1.

First back up your tables in case anything goes wrong.

Open a new query and add table1 and table2 to it. There should be a link (a black line) between the two tables' primary keys. If not, create one by dragging and dropping between the fields. If you haven't got a primary key (Bad Boy!) create the join between corresponding UNIQUE fields in your table (eg Part number) Now drag the asterisk from TABLE1 to the query grid.

Run the query as a select query. Only the records that appear in both tables should be returned. Satisfy yourself that these are the records you want to delete. Then convert the query to a delete query (Query Menu) and run it.

Now that the records in Table1 are dealt with, run an append query which appends all Table2's records to Table 1.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom