468,121 Members | 1,567 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,121 developers. It's quick & easy.

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?
Feb 20 '08 #1
6 5885
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.SetWarnings = false"

Afterwards add "DoCmd.SetWarnings = true"

I think that's right, but I'm newish.
Feb 20 '08 #2
Scott Price
1,384 Expert 1GB
Before the line in the VBA that runs the query add "DoCmd.SetWarnings = false"

Afterwards add "DoCmd.SetWarnings = true"

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

Expand|Select|Wrap|Line Numbers
  1. Application.SetOption "Confirm Action Queries", False
Do not forget to change it back to True after running your code.

Regards,
Scott
Feb 20 '08 #3
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.
Feb 20 '08 #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.
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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.  
  3. DoCmd.SetWarnings = false
  4. DoCmd.OpenQuery "YourQuery"
  5. DoCmd.SetWarnings = true
  6.  
  7. End Sub
Or is that not how you're doing it?
Feb 21 '08 #5
This took care of it:


Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2. ' Minimize the database window and initialize the form.
  3.  
  4. On Error GoTo Form_Open_Err
  5.  
  6.     ' Minimize the database window.
  7.     DoCmd.SelectObject acForm, "Switchboard", True
  8.     DoCmd.Minimize
  9.  
  10.     ' Move to the switchboard page that is marked as the default.
  11.     Me.Filter = "[ItemNumber] = 0 AND [Argument] = 'Default' "
  12.     Me.FilterOn = True
  13.  
  14. Form_Open_Exit:
  15.     Exit Sub
  16.  
  17. Form_Open_Err:
  18.     MsgBox Err.Description
  19.     Resume Form_Open_Exit
  20.  
  21. End Sub
  22.  
  23. Private Sub Form_Current()
  24. ' Update the caption and fill in the list of options.
  25.  
  26.     Me.Caption = Nz(Me![ItemText], "")
  27.     FillOptions
  28.  
  29. End Sub
  30.  


Thanks for the help folks.
Feb 27 '08 #6
Scott Price
1,384 Expert 1GB
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
Feb 27 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by TonyJeffs | last post: by
5 posts views Thread by balakrishnan.dinesh | last post: by
18 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.