Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Apr 2003
    Calgary, Alberta
    Thanked 0 Times in 0 Posts

    Change Function of Close (x) (Access 2000)

    Is there a way to change the default close method that the X does in the top right hand corner? If so, how do you access what code that x does for a specific form?


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Change Function of Close (x) (Access 2000)

    1. You can disable the "close" button by setting the Close Button property of a form to No.

    2. When the user closes a form, three events occur: On Unload, On Deactivate and On Close. The On Unload event has a Cancel argument that you can set to True if you want to prevent the user from closing the form. For example:

    Private Sub Form_Unload(Cancel As Integer)
    ' Test if txtSomething has been filled in by the user
    If IsNull(Me.txtSomething) Then
    ' Inform user
    MsgBox "You can't close the form if the Something field is empty", vbExclamation
    ' Put blinking cursor in empty text box
    ' Cancel closing the form
    Cancel = True
    End If
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts