I am getting error (Row cannot be located for updating)
Database : MySQL DB
Here's my code
I need your help guys.
Thanks in advance.
Database : MySQL DB
Here's my code
Code:
Dim rs As ADODB.Recordset
Dim sqlCriteria As String
Dim i As Long
sqlCriteria = "SELECT * FROM sql_Dependents WHERE sNumber='" & eMasterCode & "'"
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.CursorType = adOpenForwardOnly
rs.LockType = adLockOptimistic
rs.Open sqlCriteria, cn
For i = 0 To 10 - 1
With grid_Dependents
rs.Find ("cNumber = '" & grid_Dependents.CellText(i, 0) & "'")
If Not rs.EOF Then
rs!eName = .CellText(i, 1)
rs!eRelation = .CellText(i, 2)
rs!eAGE = .CellText(i, 3)
rs!eOccupation = .CellText(i, 4)
End If
rs.Update
End With
Next i
MsgBox "Record updated!", vbInformation, "Updated"
Set rs = Nothing
Thanks in advance.