T
Turner
Below I have showing some code with a "docmd.SetWarnings
True" after the Exit_SubRoutine but before the actual
Exit Sub. The question is: Is this in Violation of Good
Programming Practices?
The Plus side of doing it this way is the Set Warnings is
always returned to a TRUE status no matter what happens.
Private Sub cmdDeleteProperty_Click()
On Error GoTo Err_cmdDeleteProperty_Click
Const stMsg As String = _
"Are You Sure You Want to Delete this Property
and All its Corresponding Leases, Loans, etc."
If MsgBox(stMsg, vbYesNo + vbCritical +
vbDefaultButton2) = vbYes Then
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, ,
acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, ,
acMenuVer70
Forms!frmMain.SetFocus
Else
MsgBox "No Action Taken"
End If
Exit_cmdDeleteProperty_Click:
DoCmd.SetWarnings True 'Note Location
Exit Sub
Err_cmdDeleteProperty_Click:
MsgBox Err.Description
Resume Exit_cmdDeleteProperty_Click
End Sub
True" after the Exit_SubRoutine but before the actual
Exit Sub. The question is: Is this in Violation of Good
Programming Practices?
The Plus side of doing it this way is the Set Warnings is
always returned to a TRUE status no matter what happens.
Private Sub cmdDeleteProperty_Click()
On Error GoTo Err_cmdDeleteProperty_Click
Const stMsg As String = _
"Are You Sure You Want to Delete this Property
and All its Corresponding Leases, Loans, etc."
If MsgBox(stMsg, vbYesNo + vbCritical +
vbDefaultButton2) = vbYes Then
DoCmd.SetWarnings False
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, ,
acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, ,
acMenuVer70
Forms!frmMain.SetFocus
Else
MsgBox "No Action Taken"
End If
Exit_cmdDeleteProperty_Click:
DoCmd.SetWarnings True 'Note Location
Exit Sub
Err_cmdDeleteProperty_Click:
MsgBox Err.Description
Resume Exit_cmdDeleteProperty_Click
End Sub