Hi,
I want to create a message box that will pop up when someone clicks the close button. Basically just to confirm that they want to exit the database with yess, no buttons.
Can anyone give me the code.
Cheers
Hi,
I want to create a message box that will pop up when someone clicks the close button. Basically just to confirm that they want to exit the database with yess, no buttons.
Can anyone give me the code.
Cheers
Hi,
Do you want show message box while form closing ? If it is correct, use Message Box in Query_Unload Event or Unload Event
Hi,
you can use a code like this:
Sub btn_close_click()
Dim Response As Integer
Response = MsgBox("Are you sure you want to close the window?", vbYesNo, "Close Window?")
If Response = vbYes Then
' COMMAND TO CLOSE THE WINDOW
Else
Exit Sub
End If
End Sub
Baradaran has given the correct code.
Possible suggestion is
If the user click close button of the window it wont ask this confirmation. if the user click close command button, it works fine.
> So Unload Me
in button close
> Place the above code in Query_Unload event or Unload event.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.