NO PUEDO BORRAR EL ULTIMO REGISTRO CUANDO TRABAJO CON ADO
CUANDO TRABAJO CON ADO Y NECESITO DEJAR LA TABLA VACIA ES DECIR EN BLANCO Y BORRAR EL ULTIMO REGISTRO ME DICE QUE EOF O BOF ES TRUE Y NECESITA UN REGISTRO ACTUAL
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
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
