Access - how to procedurally suppress the delete confirmation dialog
-
Simple problem: Id 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 dont 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 its worth, heres 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:
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 at Google Answers Visit the source
Related Q & A:
- How to disable error message in file dialog?Best solution by Stack Overflow
- How can I style the header of dialog?Best solution by Stack Overflow
- How to write a letter of confirmation?Best solution by Yahoo! Answers
- How can I fix my delete key in VIM over ssh?Best solution by Stack Overflow
- How i can block and delete my contact?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.