Disable Pop Up Box

  • Thread starter Thread starter fishqqq
  • Start date Start date
F

fishqqq

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
 
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/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
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/Forums/en-US/accessdev/
 http://social.answers.microsoft.com/Forums/en-US/addbuz/
 and see alsohttp://www.utteraccess.com

Thanks John,
i'm not sure I understand what you're saying.
I have a field that has an after update macro attached to it. I was
hoping there was something I could add to the macro to stop the pop up
boxes.

I'm not sure what you mean (or what to do ) with an "execute method".
 
You can add Set Warnings False and Set Warnings True to your macro.

HOWEVER, if something goes awry while the macro executes its steps, you will
be in a situation where you will not GET ANY warnings. That is one reason to
use VBA code if you can.


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
You can add Set Warnings False and Set Warnings True to your macro.

HOWEVER, if something goes awry while the macro executes its steps, you will
be in a situation where you will not GET ANY warnings.  That is one reason to
use VBA code if you can.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

thanks that works great
 
Back
Top