I copied this code from somewhere who suggested in this form for the (X) button on top left of my MDIParent ( frmmain ) form.. but when I press the button.. it simply exits the program without the popup.. whats wrong with the code

Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    Select Case MsgBox("Are You Sure You want to exit the Program?", vbYesNo, " Exit Application")
        Case vbYes
        Call closealldb
          End
        Case vbNo
          Exit Sub
        End Select
End Sub