Google Answers Logo
View Question
 
Q: Access - how to procedurally suppress the delete confirmation dialog ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: Access - how to procedurally suppress the delete confirmation dialog
Category: Computers > Programming
Asked by: vaughn-ga
List Price: $5.00
Posted: 15 Dec 2002 01:05 PST
Expires: 14 Jan 2003 01:05 PST
Question ID: 124854
Simple problem: I’d like to procedurally (not globally) suppress the
confirmation dialog for a particular delete query. Intercepting the
"before delete confirm" event doesn't seem to work. See below more
more info.

I have a form button that displays a list of records. The button Click
event FIRST runs a DELETE query which purges the table of old records,
then opens a form to display the remaining good records. Every time it
does this, Access displays a warning confirmation dialog “You are
about to run a delete query that will modify data in your table. Are
you sure?”

I want to suppress this dialog box, just for this particular
operation.

I DONT want to globally disable Access’ delete confirmation, so I
don’t want to use the Access menu setting (clear the Record Changes
check box under Confirm on the Edit/Find tab of the Options dialog
box, under Options on the Tools menu). I also want the behavior to be
part of the database, & behave this way when distributed to other
users.

I wanted to intercept the BeforeDelConfirm event as part of the click
event code, but it appears to be only useful within a form's events.
So, I removed the DELETE query from the button click event code and
moved it to the FORM_LOAD event of the form that the button launches.
I then added a Form_BeforeDelConfirm event to the form, and it uses
the Response = acDataErrContinue option.
 
However, when I click the button, the delete query confirmation still
appears, and the Form_BeforeDelConfirm event never seems to fire.

 For what it’s worth, here’s the complete form code:
 --------------------
 Option Compare Database
 
 Private Sub Form_Load()
  DoCmd.OpenQuery ("qryDeleteOld")
 End Sub
 
 Private Sub Form_BeforeDelConfirm(Cancel As Integer, _
   Response As Integer)
  ' Suppress default Delete Confirm dialog box.
  Response = acDataErrContinue
  ' Display custom dialog box.
  If MsgBox("Hooray, this works! Delete this record?", vbOKCancel) =
 vbCancel Then
   Cancel = True
  End If
 End Sub
 ---------------------
Answer  
Subject: Re: Access - how to procedurally suppress the delete confirmation dialog
Answered By: hammer-ga on 16 Dec 2002 16:28 PST
Rated:5 out of 5 stars
 
This is an FAQ question. The answer can be found at:
http://www.mvps.org/access/queries/qry0012.htm

The home page for this FAQ is:
http://www.mvps.org/access/

This is a very good Access FAQ. I recommend you bookmark it. It's full
of good information.

Good luck with your Access project!

- Hammer
vaughn-ga rated this answer:5 out of 5 stars
Answered the question succinctly and helped point me to a great FAQ.

Thanks.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy