what do i do if i dotn want to close the form in form_close() even

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to check if user really wants to close form. So i display a msgbox and
if user doesnt want to close the form (bcoz he has not saved data) i want to
leave the form open .. how do i do this?

thanks
Rads
 
in message:
I want to check if user really wants to close form. So i display a msgbox and
if user doesnt want to close the form (bcoz he has not saved data) i want to
leave the form open .. how do i do this?

Use the Form's Unload event instead of the Close event since the Unload
event has a Cancel argument.

This is just a simplistic example here:

Private Sub Form_Unload(Cancel As Integer)
If InputBox("Password please") <> "password" Then
Cancel = True
End If
End Sub
 
Back
Top