delete records

G

Guest

I am having problems with this code:
Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click
Dim strWhere As String

strWhere = MsgBox("Do you want to delete this record?", vbYesNo)

If strWhere = vbYes Then

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Else
Exit Sub
End If

Exit_cmdDelete_Click:
Exit Sub

Err_cmdDelete_Click:
MsgBox Err.Description
Resume Exit_cmdDelete_Click

End Sub

What it is doing is every time I click the command button on the form where
I enter and delete the records it moves other fields around and move some
records to others and keeps moving the records around. Do I need to change
something to get it to delete the complete row and not move the fields
around.

I am confused on this one.
Thanks,
Pixie
 
G

Guest

In Access 2000 i would use the line
DoCmd.RunCommand acCmdDeleteRecord

This command deletes the current record.

Hope this helps.
 

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