D
deb
The below code does not delete the record if "yes" is selected.
What is wrong with this code?
Private Sub Form_Unload(Cancel As Integer)
If Me.M670 < Me.M070 Then
Msg = "M670 cannot be before M070." _
& vbCr & "If you close now, this Project will be DELETED." _
& vbCr & vbCr & "Do you want to close?"
ans = MsgBox(Msg, vbYesNo)
If ans = vbNo Then
MsgBox "Please, Select a M670 Date." _
& vbCr & "and make changes(as needed)"
Cancel = True
Else
Me.Undo
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End If
End If
Exit Sub
End Sub
What is wrong with this code?
Private Sub Form_Unload(Cancel As Integer)
If Me.M670 < Me.M070 Then
Msg = "M670 cannot be before M070." _
& vbCr & "If you close now, this Project will be DELETED." _
& vbCr & vbCr & "Do you want to close?"
ans = MsgBox(Msg, vbYesNo)
If ans = vbNo Then
MsgBox "Please, Select a M670 Date." _
& vbCr & "and make changes(as needed)"
Cancel = True
Else
Me.Undo
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End If
End If
Exit Sub
End Sub