delete records

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
In Access 2000 i would use the line
DoCmd.RunCommand acCmdDeleteRecord

This command deletes the current record.

Hope this helps.
 
Back
Top