Update Query: SetWarnings Off

G

Guest

Hello.
I am using Access 2000. I have created an Update Query and I want to turn
off the "are you sure" warnings. I have created a macro that runs the Update
query and I have SetWarnings set to "No" in the macro but I still get the
"about to update 297 records" messages. How do I make the update query silent
with not warnings?

Thanks.
Iram/mcp
 
J

John Vinson

Hello.
I am using Access 2000. I have created an Update Query and I want to turn
off the "are you sure" warnings. I have created a macro that runs the Update
query and I have SetWarnings set to "No" in the macro but I still get the
"about to update 297 records" messages. How do I make the update query silent
with not warnings?

Thanks.
Iram/mcp

Do you have the SetWarnings *before* the query execution? If so, be
sure to reset warnings to Yes after the query (or it will turn off ALL
your warnings for any problems later in the Access session!)

It's probably better to execute your queries from VBA code rather than
a macro - this will suppress warning messages AND let you trap errors:

Private Sub cmdRunQuery_Click()
Dim db As DAO.Database
Dim qd As DAO.Querydef
Set db = CurrentDb
Set qd = db.Querydefs("YourQueryNameHere")
On Error GoTo Proc_Error
qd.Execute dbFailOnError
Proc_Exit: Exit Sub
Proc_Error:
MsgBox "Error " & Err.Number & " in running query:" _
& Err.Description
Resume Proc_Exit
End Sub

John W. Vinson[MVP]
 

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