Oppress database messages

  • Thread starter Thread starter XMan
  • Start date Start date
X

XMan

Whenever I delete a cascaded record I get a database warning messages. Where
can I oppress it? TIA.
 
Whenever I delete a cascaded record I get a database warning messages. Where
can I oppress it? TIA.

<g> There's enough oppression in the world already...

To suppress the message, put

DoCmd.SetWarnings False

before executing the query; be sure to put

DoCmd.SetWarnings True

afterward.

Alternatively, and perhaps better, use the Querydef Execute method to
run the delete query:

Dim qd As Querydef
Dim db As DAO.Database
On Error GoTo Proc_Error
Set db = CurrentDb
Set qd = db.Querydefs("your-delete-query")
qd.Execute dbFailOnError
.... <other code>
Proc_Exit: Exit Sub
Proc_Error:
<error handling code here>
Resume Proc_Exit
 
Thanks.


John Vinson said:
<g> There's enough oppression in the world already...

To suppress the message, put

DoCmd.SetWarnings False

before executing the query; be sure to put

DoCmd.SetWarnings True

afterward.

Alternatively, and perhaps better, use the Querydef Execute method to
run the delete query:

Dim qd As Querydef
Dim db As DAO.Database
On Error GoTo Proc_Error
Set db = CurrentDb
Set qd = db.Querydefs("your-delete-query")
qd.Execute dbFailOnError
... <other code>
Proc_Exit: Exit Sub
Proc_Error:
<error handling code here>
Resume Proc_Exit
 
Back
Top