deleting from a form

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?
 
T

tina

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
 
J

John Vinson

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]
 
G

Guest

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
 

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