I would like to be able to click the delete button on my form (which has a subform)and have it delete the record and then have the form set to New Record.
Below is my code but it bombs on moving to a new record New record
msg... the command or action RecordsGoToNew isn't available now.
Can you help??
Private Sub btnDeleteCI_Click()
On Error GoTo Err_btnDeleteCI_Click
Me.AllowEdits = True
Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.AllowEdits = True
Me.AllowDeletions = True
Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.AllowDeletions = True
Me.AllowAdditions = True
Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.AllowAdditions = True
Msg = "Are you sure you want to delete this Customer Impact? This will delete the entire Customer Impact record."
Ans = MsgBox(Msg, vbYesNo)
If Ans = vbNo Then
MsgBox "The Customer Impact has NOT been deleted."
Exit Sub
Else
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
MsgBox "The Customer Impact has been deleted."
End If
Me.Refresh
Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.Refresh
DoCmd.RunCommand acCmdRecordsGoToNew
Below is my code but it bombs on moving to a new record New record
msg... the command or action RecordsGoToNew isn't available now.
Can you help??
Private Sub btnDeleteCI_Click()
On Error GoTo Err_btnDeleteCI_Click
Me.AllowEdits = True
Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.AllowEdits = True
Me.AllowDeletions = True
Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.AllowDeletions = True
Me.AllowAdditions = True
Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.AllowAdditions = True
Msg = "Are you sure you want to delete this Customer Impact? This will delete the entire Customer Impact record."
Ans = MsgBox(Msg, vbYesNo)
If Ans = vbNo Then
MsgBox "The Customer Impact has NOT been deleted."
Exit Sub
Else
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
MsgBox "The Customer Impact has been deleted."
End If
Me.Refresh
Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.Refresh
DoCmd.RunCommand acCmdRecordsGoToNew