Solved

Update Query fails due to Key Violations.

Posted on 2002-05-07
6
833 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

911 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

24 Experts available now in Live!

Get 1:1 Help Now