Results 1 to 2 of 2

Thread: STOP A FORM_QUERYUNLOAD?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Location
    flanders, nj 07836
    Posts
    110

    Talking

    Is there a way to stop a form from unloading? I saw some code here and mimic'd it, however it isn't working so either I have something wrong or you can't do it ?

    Assume CloseDown is just a clean up sub.


    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    Dim r
    If UnloadMode = 0 Then
    r = MsgBox("Are you sure you want to close PostIT? (You will not receive messages until you run it again)", vbYesNo)
    If r = vbNo Then
    Cancel = False
    Else
    CloseDown
    End If
    End If
    End SubSub

  2. #2
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    Code:
    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
        If MsgBox("Are you sure you want to exit", vbYesNo + vbQuestion, "Exit") = vbNo Then
            Cancel = True
        End If
    End Sub
    Change Cancel = False to Cancel = True (in your code of course )

Posting Permissions

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



Click Here to Expand Forum to Full Width