NO PUEDO BORRAR EL ULTIMO REGISTRO CON ADO
CUANDO VOY A BORRAR EL ULTIMO REGISTRO EN UNA TABLA Y SE VA A QUEDAR EN BLANCO ME DICE QUE NO PUEDE PORQUE BOF O EOF ES TRUE Y NECESITA UN REGISTRO
Es que no estás en el último sino después del último (EOF).
¿Como llegás a eso?
¿Como llegás a eso?
Te repito lo que te contesté en otro posteo
Prueba con este procedimiento para eliminar, lo puedes colocar en el evento click del botón que uses pa eliminar.
Así no tendrás dramas cuando no hay registros
Dim r As Integer
If ADO.Recordset.RecordCount = 0 Then
MsgBox "La Tabla está vacía", vbInformation, "Atención"
Exit Sub
End If
r = MsgBox("¿Desea borrar el registro?", vbYesNo, "Atención")
If r <> vbYes Then Exit Sub
ADO.Recordset.Delete 'borrar el registro actual
If ADO.Recordset.RecordCount = 0 Then
MsgBox "La Tabla quedó sin registros", vbInformation, "Atención"
Exit Sub
End If
ADO.Recordset.MoveNext 'situarse en el registro siguiente
If ADO.Recordset.EOF Then
ADO.Recordset.MoveLast
End If
Exit Sub
Saludos!
Bartolom
Chile
Prueba con este procedimiento para eliminar, lo puedes colocar en el evento click del botón que uses pa eliminar.
Así no tendrás dramas cuando no hay registros
Dim r As Integer
If ADO.Recordset.RecordCount = 0 Then
MsgBox "La Tabla está vacía", vbInformation, "Atención"
Exit Sub
End If
r = MsgBox("¿Desea borrar el registro?", vbYesNo, "Atención")
If r <> vbYes Then Exit Sub
ADO.Recordset.Delete 'borrar el registro actual
If ADO.Recordset.RecordCount = 0 Then
MsgBox "La Tabla quedó sin registros", vbInformation, "Atención"
Exit Sub
End If
ADO.Recordset.MoveNext 'situarse en el registro siguiente
If ADO.Recordset.EOF Then
ADO.Recordset.MoveLast
End If
Exit Sub
Saludos!
Bartolom
Chile