Supress delete dialog on another Table?

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
 
P

PJFry

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
 

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