On Wed, 25 May 2011 07:51:01 -0700 (PDT), "(E-Mail Removed)"
<(E-Mail Removed)> wrote:
>I have a button that basically runs a Delete query but before it
>deletes the records it's supposed to it asks the user via a pop up box
>if they wish to delete these records.
>
>Can someone please tell me how I disable these pop up boxes as they
>will likely confuse the user (who isn't aware part of their action is
>deleting records).
>
>I know i can use "Docmd.SetWarnings false " for a form but i don't
>know how to use this for a query.
>
>Suggestions are greatly appreciated.
>
>Tks
>Steve
You can use the Execute method to run the query - it doesn't bring up the
warning boxes. Sample code:
Dim db As DAO.Database ' define an object referring to the current database
Set db = CurrentDb
On Error GoTo Proc_Error
db.Execute "MyDeleteQuery", dbFailOnError
Proc_Exit:
Exit Sub
Proc_Error:
MsgBox "Error " & Err.Number & " trying to run delete query" _
& vbCrLf & Err.Description
Resume Proc_Exit
--
John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/For...-US/accessdev/
http://social.answers.microsoft.com/.../en-US/addbuz/
and see also
http://www.utteraccess.com