deleting from a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My input forms in single form view include a delete record button. When
clicked on, the visible record moves to the next and a dialoque box comes up
asking if I want to delete this record. Because the record requiring to be
deleted is no longer visible, users think they are deleting the next record
and so press 'no'. I have inserted my own "If MsgBox" code succesfully, but
the original dialogue box still comes up. How can I code the delete record so
that there is no confusion with staff?
 
turn off "warnings", delete the record, and then turn "warnings" back on, as

If MsgBox("Are you sure you want to delete this record?", _
vbYesNo) = vbYes Then
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
End If

hth
 
My input forms in single form view include a delete record button. When
clicked on, the visible record moves to the next and a dialoque box comes up
asking if I want to delete this record. Because the record requiring to be
deleted is no longer visible, users think they are deleting the next record
and so press 'no'. I have inserted my own "If MsgBox" code succesfully, but
the original dialogue box still comes up. How can I code the delete record so
that there is no confusion with staff?

Please post your code. I'm not visualizing what's going on!

You could set the Form's properties to *not* confirm deletes, and let
your code take care of it; or you could incorporate some meaningful
key field in the message box text.

John W. Vinson[MVP]
 
Thanks for that Tina

tina said:
turn off "warnings", delete the record, and then turn "warnings" back on, as

If MsgBox("Are you sure you want to delete this record?", _
vbYesNo) = vbYes Then
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
End If

hth
 
Back
Top