Disable Pop Up Box

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
 
J

John W. Vinson

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
 
F

fishqqq

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".
 
J

John Spencer

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
 
F

fishqqq

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
 

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