Cancel Close Form

  • Thread starter Thread starter John
  • Start date Start date
J

John

I have a form that displays a MSGBOX if a checkbox has a false value
(unchecked) when the form is closed. I would like to be able to stop the
closing of the form so that they can go back in and check the box.
My current code is:

Private Sub Form_Close()
If Me.SignedDisclosureAuthorization = False Then
MsgBox "You must check the Signed Disclosure Box", vbOKOnly
Else
DoCmd.CancelEvent
End If
End Sub

The MSGBOX will display if the box is not checked, but clicking OK allows
the form to continue to close.

Please advise
Thanks
 
In the UnLoad Event of the form

if me.signedDisclosureAuthorization = false then
msgbox "You must check the Signed Disclosure Box",vbOKOnly
CANCEL = TRUE
end if

HTH
 
Back
Top