[RESOLVED] deleting problem ... error 3021
Dear Friends,
Suppose I have 5 records in my database, I can delete 4 records without any error. But when I try to delete the last record, I am getting the following error: Error 3021 ..Either EOF or BOF is true....
How to solve this problem?
Margaret.
Re: deleting problem ... error 3021
Evidently if it wants to go to the next record after it deletes to last one. Without know what kind of database you have...
cxn.execute "delete from table-name" will clear all the records without trying to read the next one.
Re: deleting problem ... error 3021
Quote:
Originally Posted by Pasvorto
Evidently if it wants to go to the next record after it deletes to last one. Without know what kind of database you have...
cxn.execute "delete from table-name" will clear all the records without trying to read the next one.
Hi,
I am using Microsoft Access Database 2000. The following is the code:
VB Code:
Private Sub cmdDelete_Click()
cmdDelete.Enabled = False
Dim ano As String
ano = MsgBox("Really delete !!! " + rs.Fields("Item") + "?", vbYesNo, "Comfirm Delete?")
If ano = vbYes Then
db.Execute "Delete from Deliveries where ID like " & rs(0)
rs.Requery
Show_Record
Call Datagridcolumns
End If
cmdDelete.Enabled = True
End Sub
Margaret
Re: deleting problem ... error 3021
what were the IDs of the 5 records?
Re: deleting problem ... error 3021
Have you tried:
rs.Requery
if rs.recordcount > 0 then
Show_Record
...
endif
Re: deleting problem ... error 3021
Error Trap your delete routine.
Even though you get the error message on record 5, has that record been deleted leaving your table empty?
Re: deleting problem ... error 3021
VB Code:
Private Sub cmdDelete_Click()
cmdDelete.Enabled = False
Dim ano As String
ano = MsgBox("Really delete !!! " + rs.Fields("Item") + "?", vbYesNo, "Comfirm Delete?")
If ano = vbYes Then
db.Execute "Delete from Deliveries where ID like " & rs(0)
rs.Requery
If Not rs.EOF Then
Show_Record
Call Datagridcolumns
cmdDelete.Enabled = True
End If
End If
End Sub
Re: deleting problem ... error 3021
Hi,
Pradeep, thanks for the help. It works supurb now.
Regards,
Margaret.