M
Michael Miller
But, I know about setWarnings, and they are set, off then on.
I am capturing a Delete event, when the user clicks the row header in a
subform detail section, and allowing a delete under certain conditions. If
the condition is met, I do a Cancel = False. If they are not allowed to
delete, I do a Cancel = True.
Problem is that if I can do the delete, I also get the MS 'you are about to
delete' msg, at the very end of the proc, even tho the set warnings is set at
the beginning of the proc and the last line before the End Sub.
Maybe I should not have a setwarnings true anywhere in a Delete event???
My pertinent code is below, edited for space:
If isManagement() Then
DoCmd.SetWarnings False
With Me.RecordsetClone
.Bookmark = Me.Bookmark
Me.ProjectId.SetFocus
nParentProjectID = .[ParentProjectID]
nProjectID = .[ProjectId]
nItem = .[Item]
Response = MsgBox("This function will DELETE the CURRENT
ISSUE LINE, " & vbCrLf & _
"AND its associated CYCLE LINES!" &
vbCrLf & vbCrLf & _
"There is ***NO UNDO***!" & vbCrLf &
vbCrLf & _
"Parent Project ID: " &
nParentProjectID & vbCrLf & vbCrLf & _
"CONFIRM DELETE of Project #: " &
nProjectID & ", " & "and CURRENT Issue #: " & nItem & "?" _
, vbCritical + vbYesNo, "Are You Sure?")
If Response = vbYes Then
Cancel = False
Else
Cancel = True
End If
End With
Else
MsgBox "Only BA's and Managers can delete an Issue line" & vbCrLf &
vbCrLf & _
"Please give the Project # and Issue # to a BA or Manager,
for deletion", vbExclamation, "User Not Authorized To Delete"
Cancel = True
End If
DoCmd.SetWarnings True
End Sub
I am capturing a Delete event, when the user clicks the row header in a
subform detail section, and allowing a delete under certain conditions. If
the condition is met, I do a Cancel = False. If they are not allowed to
delete, I do a Cancel = True.
Problem is that if I can do the delete, I also get the MS 'you are about to
delete' msg, at the very end of the proc, even tho the set warnings is set at
the beginning of the proc and the last line before the End Sub.
Maybe I should not have a setwarnings true anywhere in a Delete event???
My pertinent code is below, edited for space:
If isManagement() Then
DoCmd.SetWarnings False
With Me.RecordsetClone
.Bookmark = Me.Bookmark
Me.ProjectId.SetFocus
nParentProjectID = .[ParentProjectID]
nProjectID = .[ProjectId]
nItem = .[Item]
Response = MsgBox("This function will DELETE the CURRENT
ISSUE LINE, " & vbCrLf & _
"AND its associated CYCLE LINES!" &
vbCrLf & vbCrLf & _
"There is ***NO UNDO***!" & vbCrLf &
vbCrLf & _
"Parent Project ID: " &
nParentProjectID & vbCrLf & vbCrLf & _
"CONFIRM DELETE of Project #: " &
nProjectID & ", " & "and CURRENT Issue #: " & nItem & "?" _
, vbCritical + vbYesNo, "Are You Sure?")
If Response = vbYes Then
Cancel = False
Else
Cancel = True
End If
End With
Else
MsgBox "Only BA's and Managers can delete an Issue line" & vbCrLf &
vbCrLf & _
"Please give the Project # and Issue # to a BA or Manager,
for deletion", vbExclamation, "User Not Authorized To Delete"
Cancel = True
End If
DoCmd.SetWarnings True
End Sub