Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Append Querie Error

Status
Not open for further replies.

MarkNie

Technical User
Sep 22, 2005
102
GB
Hi

Just wondering if anybody can shed some light on this for me.

I am trying to automatically append data to records with a specific field. I can get the qurie to work but when I run it there is an error which says that it can't append due to key violation. I have looked at the data type and it is just plain text so don't understand why it would give me such an error.

I have put in a composite key for the 2 fields which need to be appended to stop any duplicate entries, not sure if this might be causing the problem.

Here is the query:

INSERT INTO tblFundRepDetails ( TrackingID, [Action], Intls )
SELECT tblTracking.TrackingID, tblFundRepActs.Actions, [Auto] AS Initials
FROM tblTracking, tblFundRepActs
WHERE (((tblFundRepActs.Actions)="Attn") AND ((tblTracking.Notes)="No Attribution required"))
ORDER BY tblTracking.TrackingID
WITH OWNERACCESS OPTION;

Thanks in advance for any input.

Thanks
Regards
Mark
 
key violation means you have either

1) defined a field(s) as unique and you are trying to insert duplicate values into the field(s)

2) have referential integrity set up between tables and are trying to insert values in 1 table without values in another

--------------------
Procrastinate Now!
 
You really want a cartesian product of tblTracking and tblFundRepActs ?
If you can't join this tables then you may consider the DISTINCT predicate.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top