Hola tengo una duda, cuando quiero guardar me aparece el error "3021" El valor de BOF o EOF es True. Cual es el error?
Function Grabar() As Boolean
On Local Error GoTo LineaError
Dim RS As New ADODB.Recordset
RS.CursorLocation = adUseClient
If Trim(TxtInforme) = "" Then
MsgBox "Debe ingresar el Informe", vbExclamation
TxtInforme.SetFocus
Exit Function
End If
If Trim(TxtNestudio) = "" Then
MsgBox "Debe ingresar el número de Cine", vbExclamation
TxtNestudio.SetFocus
Exit Function
End If
Cnx.BeginTrans
RS.Open "SELECT * From HC where HC='" & TxtHC & "' and fecha=#" & TxtFecha & "#", Cnx, adOpenDynamic, adLockOptimistic
RS!Cine = TxtNestudio
RS!Informe = TxtInforme
RS.Update
SW = False
Cnx.CommitTrans
Set RS = Nothing
Grabar = True
Exit Function
LineaError:
Cnx.RollbackTrans
MsgBox Err.Description, vbCritical
End Function
Gracias!!!
Actualización:Se lo que es BOF y EOF, y cuando uso un IF me dice que tanto EOF como BOF es TRUE... WTF? En la DB ya tengo datos cargados
Copyright © 2024 ANSWERS.MX - All rights reserved.
Answers & Comments
Verified answer
BOF Begin of file
EOF End of file
Cuando el error es por BOF quiere decir que quisiste retroceder un registro en la base de datos cuando ya te encontrabas en el primer registro y por ende no puedes regresar mas.
Cuando el error es por EOF quiere decir que trataste de avanzar un registro mas adelante cuando ya te encontrabas en el ultimo registro, por eso no puedes ir mas adelante.
Saludos!