Stop Window from Popping up

Prayder

Registered User.
Local time
Today, 12:23
Joined
Mar 20, 2013
Messages
303
I created a command button from using the wizard so when I click to delete the record the button is for, a window pops up asking if I am sure I want to delete the record. Is there a way to not have the button pop up?

Here is the code:
Code:
Private Sub cmdCompleted_Click()
On Error GoTo Err_cmdCompleted_Click


    DoCmd.RunCommand acCmdSelectRecord
    DoCmd.RunCommand acCmdDeleteRecord

Exit_cmdCompleted_Click:
    Exit Sub

Err_cmdCompleted_Click:
    MsgBox Err.Description
    Resume Exit_cmdCompleted_Click
    
End Sub
 
Look into SetWarnings or delete it it by executing a DELETE query.
 
Since the code is written using a wizard there not setwarnings parameters(at least that I can see) in the code or anywhere in the module itself.
 
Got it.

Code:
Private Sub cmdCompleted_Click()
On Error GoTo Err_cmdCompleted_Click
    
    DoCmd.SetWarnings False
    DoCmd.RunCommand acCmdSelectRecord
    DoCmd.RunCommand acCmdDeleteRecord
    DoCmd.SetWarnings True

    
Exit_cmdCompleted_Click:
    Exit Sub

Err_cmdCompleted_Click:
    MsgBox Err.Description
    Resume Exit_cmdCompleted_Click
    
End Sub
 

Users who are viewing this thread

Back
Top Bottom