No Show Delete Confirm popup

J

Jim D

When deleting records from a form I want to create my own
delete confirm popup up because linked records will be
deleted and the default delete confirm isn't clear. I've
put a popup in the OnDelete event but the default popup
still comes up. Is there any way to disable the default
popup.

Thanks
Jim
 
J

Jim D

Thanks Bill,
I thought about that but then I would have to set that
option at start up because there's multipul users. I was
hoping there was a programatic way to do it.

Thanks again
Jim
 
A

Andy Cole

Jim

Try adding

DoCmd.SetWarnings False

and

DoCmd.SetWarnings True

around your delete code

HTH

Andy
 
A

Allen Browne

To suppress the dialog question for just this one form, use the
BeforeDelConfirm event of the form:
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
Response = acDataErrContinue
End Sub

Using the OnDelete event to display your own message box is fine. The
functional difference is that if the user selects multiple records at a time
(e.g. in Continuous or Datasheet view), they will receive one MsgBox for
each record, whereas the default behaviour in the BeforeDelConfirm event is
one MsgBox for all.
 
Joined
May 14, 2008
Messages
1
Reaction score
0
Hi, I'm working on an Excel/VBA assignment where I need to delete a temporary worksheet that I created when I click on Cancel and I just want to disable the delete confirmation box that pops up everytime the Cancel button is clicked.

This is my code at the moment:

Private Sub cmdCancel_Click()
Unload Me

DoCmd.SetWarnings False
Application.Sheets("New Order").Select
ActiveWindow.SelectedSheets.Delete
DoCmd.SetWarnings True

End Sub

It seems to work except that it comes up as a run-time error: "Object variable or With block variable not set".

Any help would be much appreciated! TIA :)
 
Last edited:

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