Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Strange ADODB Error Too Many Rows Affected

Hello everyone, I am writing a payroll program that will check between billing codes and payroll codes. I am running an edit, which is a process that compares the billing data and payroll data, and prints out a report of what errors it has found. The program checks between a table, that has approximately 500 - 600 records, and will open it using an ADODB recordset, and make changes. The program is working fine, but towards the end I get runtime error.

-2147467259(80004005)
Key Column information is insufficient or incorrect. Too many rows were affected by update.

Here is some of the sample code I have wehre the process is taking place. I researched this error, and apparently it is mainly if I have too many recordsets open at once, but I have only one recordset open while this commmand is in effect.

[code]
Private Sub CmdRun_Click()
Open_2000PR
CmdRun.Visible = False

Dim check, RecCountPR, RecCountEM As Double
Dim ProvNum, clinum, Rhrs, Phrs, ecode, BillingCode As String
Dim DateDay As String
Dim DTday As String
Dim DTmon As String
Dim BillingCodeCheck As Boolean
Dim CurRecord As Double
Dim CheckDate As Double
Dim ResetClientHours As Double
Dim ResetProvHours As Double

RecCountPR = PR2000.RecordCount
PrgBar.Max = PR2000.RecordCount
BillingCodeCheck = False
CurRecord = 0

Label2.Caption = "Reseting Payroll Error Codes"
DoEvents
If RecCountPR > 0 Then '---------- 1
PR2000.MoveFirst
Do While PR2000.EOF = False
PrgBar.Visible = True
CurRecord = CurRecord + 1
PrgBar.Value = CurRecord
If IsNull(PR2000.Fields("Codes").Value) Then
Else
PR2000.Fields("Codes").Value = " "
End If
PR2000.MoveNext
Loop
PR2000.Update
End If '-------------------------- 1
End Sub
[/code]

I am also including my ADODB connection string that I have placed as a global function in a module, so that I will not need to type out the entire connection string each time I need to open it.

[code]

Function Open_PayrollDB()
'Checking for instance of open connection, if open it will close
If PayrollDB.State = adStateOpen Then
PayrollDB.Close
End If

PayrollDB.Open "Provider=Microsoft.Jet.OLEDB.4.0;persist security info =false;data source=f:databasesPayroll.mdb"

End Function

Function Open_2000PR()
' Temporary Payroll Table for Formatting
If PR2000.State = adStateOpen Then
PR2000.Close
End If
'setting cursor and open information for recordset table
With PR2000
.ActiveConnection = PayrollDB
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Source = "select * from 2000PR"
.Open
End With
End Function
[/code]

Someone please help, thank you.
Sign In or Register to comment.