I have a form with subform.
When the user clicks to close form, check to see if the date field is left
as a 1 or null
If it is 1 or null, prompt to make sure they want to exit without choosing
date.
My below code is not working. Any suggestions?
Private Sub Form_Close()
On Error GoTo Err_FormClose
If IsNull(Me.ReportDtID) Or Me.ReportDtID = 1 Or Me.ReportDtID = "Enter
Date" Then
Me.AllowEdits = True
Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.AllowEdits =
True
Me.AllowDeletions = True
Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.AllowDeletions =
True
Msg = "Are you sure you want to close without choosing a date? This will
delete the record."
Ans = MsgBox(Msg, vbYesNo)
If Ans = vbNo Then
MsgBox "The Customer Impact has NOT been deleted. Choose date and close form"
Exit Sub
Else
Me.Undo
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End If
End If
exit_Form_Close:
Exit Sub
Err_Form_Close:
MsgBox Err.Description
Resume exit_Form_Close
When the user clicks to close form, check to see if the date field is left
as a 1 or null
If it is 1 or null, prompt to make sure they want to exit without choosing
date.
My below code is not working. Any suggestions?
Private Sub Form_Close()
On Error GoTo Err_FormClose
If IsNull(Me.ReportDtID) Or Me.ReportDtID = 1 Or Me.ReportDtID = "Enter
Date" Then
Me.AllowEdits = True
Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.AllowEdits =
True
Me.AllowDeletions = True
Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.AllowDeletions =
True
Msg = "Are you sure you want to close without choosing a date? This will
delete the record."
Ans = MsgBox(Msg, vbYesNo)
If Ans = vbNo Then
MsgBox "The Customer Impact has NOT been deleted. Choose date and close form"
Exit Sub
Else
Me.Undo
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End If
End If
exit_Form_Close:
Exit Sub
Err_Form_Close:
MsgBox Err.Description
Resume exit_Form_Close