Supress delete dialog on another Table?

  • Thread starter Thread starter bhammer
  • Start date Start date
B

bhammer

My form has a command button that runs:

Private Sub cmdClearList_Click()
Dim SQL As String
SQL = "DELETE tblCatalog_Temp.* " & _
"FROM tblCatalog_Temp;"
DoCmd.RunSQL SQL
End Sub

I don't want the user to have to answer the obligatory dialog, and I don't
want to globally turn it off via Tools/Options.

I have the following too, but of course it doesn't apply to records in the
other table.

Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
' Suppress default Delete Confirm dialog box.
Response = acDataErrContinue
' Display custom dialog box.
If MsgBox("Delete this record?", vbOKCancel) = vbCancel Then
Cancel = True
End If
End Sub
 
Have you tried:

Private Sub cmdClearList_Click()

DoCmd.SetWarnings False

Dim SQL As String
SQL = "DELETE tblCatalog_Temp.* " & _
"FROM tblCatalog_Temp;"
DoCmd.RunSQL SQL

DoCmd.SetWarnings True

End Sub

PJ
 
Back
Top