Cancel Close Form

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
 
N

Newbie

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top