• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 541
  • Last Modified:

Access 2003: Append and Delete Query pop-ups - Want to remove them when used in a Form

Hello Experts,

I have a form with command buttons for an append query and a delete query. When you use them 2 pop ups come up... i would like to get rid of this so it will just ask the user if they are sure and than carry out the task so that it can avoid confusion with multiple users who have no experience with access. Help is greatly appreciated. Thank you
0
jtovar3
Asked:
jtovar3
  • 4
  • 4
  • 3
  • +2
3 Solutions
 
ki_kiCommented:
in your commande button before you run the querries add:
docmd.setwarnings false
0
 
jmoss111Commented:
Try wrapping DoCmd.SetWarnings False
and
DoCmd.SetWarnings False
around the queries. You can also manipulate Options in code
0
 
Rey Obrero (Capricorn1)Commented:
if you use

DoCmd.SetWarnings False

' make sure that you set it back to true

run query here


DoCmd.SetWarnings True
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
jmoss111Commented:
Also, at main form load you could put a function in the OnLoad event:

Public Function funSetOptionsFalse()
    Application.SetOption "Confirm Action Queries", False
    Application.SetOption "Confirm Document Deletions", False
    Application.SetOption "Confirm Record Changes", False
End Function

and if you wanted to return the options back, put another function in the close with True for option param
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:


     If MsgBox("Are you sure you want to run these queries?", 36, "RUN") = vbYes Then
        With DoCmd
            .SetWarnings False
            .Hourglass True
            .OpenQuery "YourAppendQueryName"
            .OpenQuery "YourDeleteQueryName"
            .Hourglass False
            .SetWarnings True
        End With
     End If
0
 
jtovar3Author Commented:
hey guys that worked perfectly... last part... how do i create a msgbox with a yes or no to make sure the user wants to run the delete query therefore avoiding mistakes?
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
See my post!

mx
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:




     If MsgBox("Are you sure you want to run these queries?", 36, "RUN") = vbYes Then
        With DoCmd
            .SetWarnings False
            .Hourglass True
            .OpenQuery "YourAppendQueryName"
            .OpenQuery "YourDeleteQueryName"
            .Hourglass False
            .SetWarnings True
        End With
     End If

Also ... I would suggest you NOT do the following ... because that turns the warnings off Globally ... and you should to it on an as needed basis:

    Application.SetOption "Confirm Action Queries", False
    Application.SetOption "Confirm Document Deletions", False
    Application.SetOption "Confirm Record Changes", False
------------------------------------------

mx
0
 
jtovar3Author Commented:
yes i understand that it would turn the warnings off globally but like capricorn said i would be reseting them as soon as the action was complete... is this not correct? so if i put DoCmd.SetWarnings True after the end if statement shouldnt i be alright?
0
 
jmoss111Commented:
You only turn them off globally if you manipulate Options like I showed you.  And your statement is correct, and yes if you setwarnings true you are alright.

I usually turn off globally at beginning of session and turn on globally at end of session and question only where needed.
0
 
jtovar3Author Commented:
thanks for the answer jmoss... ill try to split the points as fairly as i can... once again i really appreciate the help and feedback everyone gave... really helped me learn
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
"so if i put DoCmd.SetWarnings True after the end if statement shouldnt i be alright?"

You should also put that in the OnClose event of the form ... in case an error occurs and that line never executes.  There are many other ramifications of having that stuck in a False state ... such as you will NOT be prompted for design changes in any object ... it will *automatically* just Save changes.  So ... Beware.

mx
0
 
jtovar3Author Commented:
mx, thanks for the heads up... will do that
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 4
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now