Last (blank) record on form will not delete!

C

cavyman

I have a "Delete Record" command button on my form, however it will not
delete the last record. For example, I have 29 records and when I
create a new record, the record count goes to 30 of 30 records. If I do
not enter anything into the new record on the form but just click
Delete Record instead, the record just stays blank and stays on record
30. If I create yet another new record (31 of 31), I can click to go
back to record 30 (of 31) and then delete record 30 thus taking it back
to 30 of 30 records. It will not go back to record 29 of 29 which is a
fully filled out record. I'm new to both Access and VBA, so I'm sorry
if this is a stupid question (or if I'm missing something simple). I've
been trying to teach myself how to do all of this, but this one has me
stumped. Thanks!

My code for the delete command button is:

Private Sub ProposalDelete_Click()
On Error GoTo Err_ProposalDelete_Click

DoCmd.RunCommand acCmdDeleteRecord
DoCmd.GoToRecord , , acPrevious

Exit_ProposalDelete_Click:
Exit Sub

Err_ProposalDelete_Click:

Resume Exit_ProposalDelete_Click

End Sub
 
G

Guest

There is no "blank record" to delete; i.e. there is a blank space on the Form
in which you may enter a new record, if you wish; but there is no record
stored in the table.

If you do not want the blank record to be visible on the form (and thereby
to prevent the user from adding any new records to the table) set the Form's
Allow Additions property to No.
 
D

Danny J. Lesandrini

I'm thinking that there are no required fields, thus the possibility for
creating a blank record. Perhaps it doesn't even have an autonumber
nor a primary key. If you set at least one field as required, then maybe
the remnamts of abandoned new records won't persist.
--

Danny J. Lesandrini
(e-mail address removed)
http://amazecreations.com/datafast
 

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