Query Confirmations still opening

T

tighe

all,

i figure my solution is to turn off warnings, but i wondered if any knew why
query confirmations are still happening when the user says the "confirm" in
Editing Advanced Options are unchecked: Record changes, Document Deletions,
Action Queries. the user is usually offsite and have no direct access to
check whether this is actually true.

if any knows why the issue is occurring or has a better solution let me
know, TIA.
 
J

Jerry Whittle

You need to to use Set Warnings in code or a macro. Below is an example of a
Make Table query. You could do something similar with a macro and a saved
query. You SetWarnings to False before doing the query. Then, and this is
important, set it back to True afterwards.

Public Sub DoSQL()

Dim SQL As String

DoCmd.SetWarnings False
SQL = "SELECT * INTO Backlog FROM ASA "

DoCmd.RunSQL SQL
DoCmd.SetWarnings True

End Sub
 
J

John W. Vinson

You need to to use Set Warnings in code or a macro. Below is an example of a
Make Table query. You could do something similar with a macro and a saved
query. You SetWarnings to False before doing the query. Then, and this is
important, set it back to True afterwards.

Public Sub DoSQL()

Dim SQL As String

DoCmd.SetWarnings False
SQL = "SELECT * INTO Backlog FROM ASA "

DoCmd.RunSQL SQL
DoCmd.SetWarnings True

End Sub

Even better, in my experience, is to avoid the RunSQL method altogether;
instead use the Execute method:

Dim SQL As String
On Error GoTo Proc_Err
SQL = "SELECT * INTO Backlog FROM ASA"
Application.Execute SQL, dbFailOnError
<other code>

Proc_Exit:
Exit Sub
Proc_Err:
<handle any errors generated by the query>
Resume Proc_Exit
 

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