Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Update Query fails due to Key Violations.

Posted on 2002-05-07
6
835 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

856 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