Hello All!
I'm getting errors 3265 and -2147217900 when adding records through ADO. The problem is that it's not happening consistently. When adding records, sometimes it'll error 3265 on the 8th one, then the 3rd one. It'll do it on around the 3rd record entered for a couple more times after it does it on the 8th one and then either crash out completely OR give me an error -2147217900 and then crash out either right after that error or after another few records are entered. Sometimes it'll give this -2147217900 error right off the bat with the first added record. It's seemingly random. But there has to be method to this madness. Also of note is the fact that, once one of these errors occur, I can go ahead and add the record it just gave the error on, assuming it doesn't crash right after the error.
Error 3265 is: Item cannot be found in the collection corresponding to the requested name or ordinal.
Error -2147217900 is: Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or UPDATE'.
I'll tell afterwards which error occurs where. There's a lot more to the procedure, but here's the ADO code that's adding the record:
Code:
Set rst = New ADODB.Recordset
rst.Open "LaborCost", CurrentProject.Connection, adOpenForwardOnly, adLockPessimistic
With Me
rst.AddNew Array("Date", "EmployeeNo", "RegularHoursWorked", "OvertimeHoursWorked", _
"HolidayPay", "Justification", "Comments", "PayRate", "OTPayRate", "MineNo", _
"Section", "Shift", "TrainType", "TrainHours"), _
Array(.Date, .cboEmployeeNo, .RegularHoursWorked, .OvertimeHoursWorked, .HolidayPay, _
.cmbJustification, .Comments, .txtPayRate, .txtOTPayRate, .cmbMineNo, .txtSection, _
.txtShift, .cmbTrainType, .txtTrainHours)
End With
rst.Update
rst.Close
Set rst = Nothing
Error 3265 occurs in the rst.AddNew command. Error -2147217900 occurs in the rst.Open command.
Sorry for the lengthy message. Thank you much in advance! If you need any info on the data types of any of the fields, let me know. Consistent problems are doable...inconsistent problems are stomach twisting.