Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete confirmation box

Status
Not open for further replies.

jpmillr1

Technical User
Jun 13, 2003
12
0
0
US
I have a form with a delete record button, but I would like it to keep the form open if the delete is cancelled, or close the form and go to another if the delete is confirmed. How is this done? I am trying to figure out a macro or an SQL statement, but I am stuck.

Thanks,
John
 
This one works in the form's Ondelete event, but is Access not prompting you to confirm deletes anyway?

Private Sub Form_Delete(Cancel As Integer)
Dim intResponse As Integer
intResponse = MsgBox("Are you sure you want to Delete?", vbOKCancel, "Confirm Delete")
If intResponse = vbOK Then
Exit Sub
Else
Cancel = True
End If

End Sub
 
Yep, it does ask to confirm. I just want different actions to take place when this delete prompt comes up.

For example, if you click "Ok" it closes the form and goes to another.

If you "Cancel" it leaves the current form open.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top