Solved

Update Query fails due to Key Violations.

Posted on 2002-05-07
6
832 Views
Last Modified: 2008-03-03
Im am trying to perform an update query on a table that contains 2 Primary Keys but when i try and call the query i get the following message:

Cant update all the records in the Update Query.

Tivoli Fixes didnt update 0 field(s) due to a type conversion failure, 20 record(s) due to key violations, 0 record(s) due to lock violations and 0 record(s) due to validation rule violations.

i looked in the help - and it suggests that within the code i can use the Primary Proerty and change the primary keys to non-primary while i perform the update query and then set them back. Please could you help me  on how i would do this?
0
Comment
Question by:Sheets
6 Comments
 
LVL 54

Accepted Solution

by:
nico5038 earned 50 total points
ID: 6994064
Normally you won't use an update query to change the primekey (or keys) of a table.
To change those you would use an Append (INSERT INTO) query followed by a DELETE.
A primekey identifies a row. Changing it implies effectively adding a new one and removing the old one.
Clear sofar ?

What is it exactly that you're trying to achieve?

Ni';o)
0
 
LVL 57
ID: 6994125
Key violations are the result of one of two things:

1. Duplicate key on an index that doesn't allow duplicates (i.e. the primary key).

2. You have a relationship (M-O) with another table and their is no corresponding parent record in that table.

Jim.
0
 

Author Comment

by:Sheets
ID: 6994160
Thanks for the replies but youre right - i didnt need to do an update query!! I was getting abit confused. I actually wanted to insert a new record - but its all sorted and it all works. thanks.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 54

Expert Comment

by:nico5038
ID: 6994187
Glad I could help ;-)

Nic;o)
0
 
LVL 54

Expert Comment

by:nico5038
ID: 7215750

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
 - Answered by: nico5038  
Please leave any comments here within the
next seven days.

Nic;o)
0
 

Expert Comment

by:Jgould
ID: 7240028
Question has been force accepted as per recommendation

JGould-EE Moderator
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now