Query Confirmations still opening

  • Thread starter Thread starter tighe
  • Start date Start date
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.
 
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
 
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
 
Back
Top