Append query - key violation

antifashionpimp

Registered User.
Local time
Today, 07:28
Joined
Jun 24, 2004
Messages
137
Hello,

I have looked at some posts in here, but I still have the following question:

I have a database with a table say tblPeople. This table contains e.g. the following fields:

ID----NAME----SURNAME----HAND---PERCENT1---PERCENT2
1-----John--------Jones------(empty)---(empty)-----(empty)
1-----Mary-------Masters----(empty)---(empty)-----(empty)

ID is the primary key.

Therefore, the data in this table already exists for fields, ID, NAME and SURNAME, but not for HAND, PERCENT1 and PERCENT2.

I then imported data from a spreadsheet into another table, say tblTemp (without primary key) which now contains the data for each person’s HAND, PERCENT1 and PERCENT2, and in this table there is exactly the same amount of records as in tblPeople. I want to add the data from tblTemp top tblPeople now and have used an append query. I get the error message though “not appended due to key violations” for all the records to be added.

Here is the SQL for the append query:

Code:
INSERT INTO tblPeople ( Hand, Percent1, Percent2 )
SELECT tblTemp.Feld1, tblTemp.Feld2, tblTemp.Feld3
FROM tblTemp;

How can I get past this? Thanks for tips in advance!

Regards,
Jean
 
ID----NAME----SURNAME----HAND---PERCENT1---PERCENT2
1-----John--------Jones------(empty)---(empty)-----(empty)
1-----Mary-------Masters----(empty)---(empty)-----(empty)

ID is the primary key.


I assume the duplicate id's (1), was a type-o...

???
kh
 
Hi Ken,

don't completely know why I should use an update query. In the QBD grid, should I add the tblTemp first? Then what?
Please help. :)

BTW yes that was a typo.
 
In qbe, (as an update query), bring in both tables and make sure you have the id flds linked. Then bring down tblPeople.fldx, etc. In the update row, place tblTemp.fldx, etc.

???
kh
 

Users who are viewing this thread

Back
Top Bottom