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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Updating Records - MySQL

Status
Not open for further replies.

aberry

MIS
Jun 6, 2002
24
0
0
Hi,

I have 1 table in a MySQL database which I am trying to update all the records in programatically. If I update the records manually there are no problems.

The code updates 39 records and then bombs with the following error message:-

Key column information is insufficient or incorrect.Too many rows were affected by update.

Any ideas how to get around this?

Cheers,

Andrew

Snippets of code as follows:-

rsPadTrans.ActiveConnection = db
rsPadTrans.CursorLocation = adUseClient
rsPadTrans.LockType = adLockOptimistic

Do Until rsPadTrans.EOF = True
With rsPadTrans
.Fields("Invoiced") = "Y"
.Fields("InvDate") = Left(sDate, 2) & "/" & Mid(sDate, 3, 2) & "/" & Right(sDate, 2)

.Update

.Requery
End With

StatusBar1.Panels(1).Text = "There are " & rsPadTrans.RecordCount & " records to be processed. Export records"
rsPadTrans.MoveNext
iLoop = iLoop + 1
Loop
 
Does your table have a primary key?
If not add one - that should work ...
 
brilliant, thanks for your help. All working now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top