Deleting the Only Record in the Recordset

G

Guest

Hi,
I have a form where a user can add,update, and delete records. The deletion
process works fine if I'm deleting records when there is at least one record
left in the recordset after deletion. However I get an error when I try to
delete the only record left in the recordset. The error states "No Current
Record". I'm guessing the form is trying to go to the next record when there
is none, but I need to allow the user to delete All the existing records
without error and just go to a blank form when the Last record is deleted.
Here is my code for deleting records:

intBox = MsgBox("Are you sure you wish to Delete this User?", vbYesNo,
"Delete User?")
If intBox = 6 Then 'checks if the record should really be deleted

Me.Recordset.Delete

End if

Please Help?

THanks,
Alex
 
D

Douglas J. Steele

Since forms are based on the data in tables, why worry about the recordset?
Just delete all of the data from the table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top