Remove "Yes" "No" Confirmation from Queries

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RSbroman
    New Member
    • Feb 2008
    • 3

    Remove "Yes" "No" Confirmation from Queries

    I have created an append query that I would like to run when the DB is opened.
    However I do not want the end user to receive the "yes" "no" confirmation box when the query is being run.

    Can anyone help me remove this confirmation box?
  • pelicanstuff
    New Member
    • Nov 2007
    • 24

    #2
    Originally posted by RSbroman
    I have created an append query that I would like to run when the DB is opened.
    However I do not want the end user to receive the "yes" "no" confirmation box when the query is being run.

    Can anyone help me remove this confirmation box?
    Before the line in the VBA that runs the query add "DoCmd.SetWarni ngs = false"

    Afterwards add "DoCmd.SetWarni ngs = true"

    I think that's right, but I'm newish.

    Comment

    • Scott Price
      Recognized Expert Top Contributor
      • Jul 2007
      • 1384

      #3
      Originally posted by pelicanstuff
      Before the line in the VBA that runs the query add "DoCmd.SetWarni ngs = false"

      Afterwards add "DoCmd.SetWarni ngs = true"

      I think that's right, but I'm newish.
      The DoCmd.SetWarnin gs = False and True is correct. As an added option, that I now prefer, you can use the more specific:

      Code:
      Application.SetOption "Confirm Action Queries", False
      Do not forget to change it back to True after running your code.

      Regards,
      Scott

      Comment

      • RSbroman
        New Member
        • Feb 2008
        • 3

        #4
        I did figure out one way to do this. Access 07 - Select Office Button, Access Options, Advanced, then uncheck "Action Queries". However this does not remove confirmation box for users other than yourself on your local machine.


        When using VB Script all that I see is code for Form. Nothing appears for tables or queries.

        Comment

        • pelicanstuff
          New Member
          • Nov 2007
          • 24

          #5
          Originally posted by RSbroman
          I did figure out one way to do this. Access 07 - Select Office Button, Access Options, Advanced, then uncheck "Action Queries". However this does not remove confirmation box for users other than yourself on your local machine.


          When using VB Script all that I see is code for Form. Nothing appears for tables or queries.
          Where is your query running from? I assumed that since you said it was to run on opening of the application, it would be run from the Form_Load() event of your default form like so:

          Code:
          Private Sub Form_Load()
          
          DoCmd.SetWarnings = false
          DoCmd.OpenQuery "YourQuery"
          DoCmd.SetWarnings = true
          
          End Sub
          Or is that not how you're doing it?

          Comment

          • RSbroman
            New Member
            • Feb 2008
            • 3

            #6
            This took care of it:


            [CODE=vb]
            Private Sub Form_Open(Cance l As Integer)
            ' Minimize the database window and initialize the form.

            On Error GoTo Form_Open_Err

            ' Minimize the database window.
            DoCmd.SelectObj ect acForm, "Switchboar d", True
            DoCmd.Minimize

            ' Move to the switchboard page that is marked as the default.
            Me.Filter = "[ItemNumber] = 0 AND [Argument] = 'Default' "
            Me.FilterOn = True

            Form_Open_Exit:
            Exit Sub

            Form_Open_Err:
            MsgBox Err.Description
            Resume Form_Open_Exit

            End Sub

            Private Sub Form_Current()
            ' Update the caption and fill in the list of options.

            Me.Caption = Nz(Me![ItemText], "")
            FillOptions

            End Sub
            [/CODE]



            Thanks for the help folks.
            Last edited by Scott Price; Feb 27 '08, 07:17 PM. Reason: code tags

            Comment

            • Scott Price
              Recognized Expert Top Contributor
              • Jul 2007
              • 1384

              #7
              I commend you on an innovative solution!

              I do wonder, however, if this would work equally well without the step you mentioned in post #4? Those Yes/No popup boxes are usually modal, which means that they must be satisfied before moving on with the program.

              I don't see anything in your code which changes this default modal behavior, so you must be changing that somewhere else.

              Thanks for posting back with your solution.

              Regards,
              Scott

              Comment

              Working...