Append new records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi:

I would like to append to a table just the new records;
So if today I appended 1 and 2; and tomorrow the result of the query is 1,2
and 3, I want to append just the 3 one.

How do I do that?

Thanks,

Dan
 
Huh? What are you appending from and to?

Why are you copying records to another table? Normally you would not want
that redundancy.

To answer your question, your append query should only pull (and thus
append) the new records. If you do this daily, then use a date added field
in the record to only pull records that apply. But, again, you most likely
should not be doing this.
 
Hi Lynn:

The old records are already there: ID(S) 1 and 2 are in the table that I am
appending to. Later, the result of the qry is 1,2 and 3=new; I want to append
just 3.

You can do that by making the ID (no duplicates) but I would not do that.

Thanks,

Dan
 
Then only pull item 3 to your query.

Or do an unmatched query to find which ones are missing.

BUT, you either have a one-to-one relationship (each table has one record
for each control) or you are duplicating data. If you have a one-to-one
relationship, then you don't need to jump through hops and use a query, just
build your relationship.
 
Assuming
TableA as the Source table
TableB as table being appended
A way to link the two tables (primary key same in both)

INSERT INTO TableB (FieldA, FieldB, FieldC)
SELECT A, B, C
FROM TableA LEFT JOIN Table B
ON TableA.PrimaryKey = TableB.PrimaryKey
WHERE TableB.PrimaryKey is Null
 
Yes; please see below:

INSERT INTO [DQ Issues] ( StoreNo )
SELECT [Mac+Nots].[Natl#]
FROM [Mac+Nots] LEFT JOIN [DQ Issues] ON [Mac+Nots].[Natl#] = [DQ
Issues].NatlStoreNo
WHERE ((([DQ Issues].NatlStoreNo) Is Null));

Thanks,

Dan
 
Thanks John!

I am doing the same; but is this a "bullet proof"; are there any other ways?

Thanks,

Dan

INSERT INTO [DQ Issues] ( StoreNo )
SELECT [Mac+Nots].[Natl#]
FROM [Mac+Nots] LEFT JOIN [DQ Issues] ON [Mac+Nots].[Natl#] = [DQ
Issues].NatlStoreNo
WHERE ((([DQ Issues].NatlStoreNo) Is Null));
 
Bullet proof? I don't know.

Other ways - there are always other ways.
Use VBA and step through Mac+Nots records
Check Dq Issues for existing record
If no existing record, add a record and populate it.
If an error occurs, ...


D said:
Thanks John!

I am doing the same; but is this a "bullet proof"; are there any other
ways?

Thanks,

Dan

INSERT INTO [DQ Issues] ( StoreNo )
SELECT [Mac+Nots].[Natl#]
FROM [Mac+Nots] LEFT JOIN [DQ Issues] ON [Mac+Nots].[Natl#] = [DQ
Issues].NatlStoreNo
WHERE ((([DQ Issues].NatlStoreNo) Is Null));


John Spencer said:
Assuming
TableA as the Source table
TableB as table being appended
A way to link the two tables (primary key same in both)

INSERT INTO TableB (FieldA, FieldB, FieldC)
SELECT A, B, C
FROM TableA LEFT JOIN Table B
ON TableA.PrimaryKey = TableB.PrimaryKey
WHERE TableB.PrimaryKey is Null
 
Back
Top