I have the following code attached to my forms Unload event.
The code works great if the user selects yes when prompted to exit the DB, but the No selection does not work, i get no error, and the DB closes.
If the user selects no, the form should not close, and no further action should take place. Not sure what i am doing wrong, please assist.
Code:
'Ask user if they want to close the session, and act accordingly.
Select Case MsgBox("Are you sure you Want to Exit ?", vbYesNo, "Warning")
Case vbYes
Me.DBSessionClosedDate = Now()
Me.DBSessionClosed = True
DoCmd.SelectObject acTable, , True
ResetWorkspace
DoCmd.Quit
Case vbNo
DoCmd.CancelEvent
Cancel = True
Exit Sub
End Select