M
Mishanya
In my form I have Delete Button coded by the wizard with some modification as
follows:
Private Sub btnDeleteAsset_Click()
On Error GoTo Err_btnDeleteAsset_Click
If MsgBox("Are You sure You want to delete this asset?", _
vbYesNo + vbExclamation, "Attention!") = vbNo Then
Me.Undo
Cancel = True
Else
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
MsgBox "The deletion is completed"
Exit_btnDeleteAsset_Click:
Exit Sub
Err_btnDeleteAsset_Click:
MsgBox "Your deletion attempt is aborted"
Resume Exit_btnDeleteAsset_Click
End If
End Sub
The events caused by pressing the button go as this:
1) My message "Are You sure You want to delete this asset?"
if NO selected - this is it
if YES selected
2) Access message box "You are about to delete 1 record", while the record
I'm trying to delete is changed by the next record
if NO selected
3) My message "Your deletion attempt is aborted", while the recordset is
back to the attempted
if YES selected
3) My message "The deletion attempt is completed"
The step 2) is quite confusing - firstly, it doubles my message, secondly -
next record is already presented, wich makes the user hesitate what is he
about to delete.
How can I modify the code so the whole thing will work properly:
1) no Access messages but defined by me
2) no next record popping up in the step 2 (ideally - I still see the
attempted record)
3) after the deletion is completed the form is in New record mode (again, no
next record popping up)?
follows:
Private Sub btnDeleteAsset_Click()
On Error GoTo Err_btnDeleteAsset_Click
If MsgBox("Are You sure You want to delete this asset?", _
vbYesNo + vbExclamation, "Attention!") = vbNo Then
Me.Undo
Cancel = True
Else
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
MsgBox "The deletion is completed"
Exit_btnDeleteAsset_Click:
Exit Sub
Err_btnDeleteAsset_Click:
MsgBox "Your deletion attempt is aborted"
Resume Exit_btnDeleteAsset_Click
End If
End Sub
The events caused by pressing the button go as this:
1) My message "Are You sure You want to delete this asset?"
if NO selected - this is it
if YES selected
2) Access message box "You are about to delete 1 record", while the record
I'm trying to delete is changed by the next record
if NO selected
3) My message "Your deletion attempt is aborted", while the recordset is
back to the attempted
if YES selected
3) My message "The deletion attempt is completed"
The step 2) is quite confusing - firstly, it doubles my message, secondly -
next record is already presented, wich makes the user hesitate what is he
about to delete.
How can I modify the code so the whole thing will work properly:
1) no Access messages but defined by me
2) no next record popping up in the step 2 (ideally - I still see the
attempted record)
3) after the deletion is completed the form is in New record mode (again, no
next record popping up)?