Hi
I would like to prevent the user from closing a userform and exiting the database by clicking the 'X'
on the right side of the titlebar. I need to force closure by using a
command button, and running an exit procedure. I have exit buttons set up on the form but users are ignoring them. Is there a property setting that will prevent this / or run the exit procedure when the 'X' is clicked? I am using acess 2010.
I have found a code (below) but it does not work and other mention using Query close but I cannot find it in the event tab.
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "You can't close the dialog like this!"
End If
End Sub
Can anyone help? Much appreciated.
janeyg
I would like to prevent the user from closing a userform and exiting the database by clicking the 'X'
on the right side of the titlebar. I need to force closure by using a
command button, and running an exit procedure. I have exit buttons set up on the form but users are ignoring them. Is there a property setting that will prevent this / or run the exit procedure when the 'X' is clicked? I am using acess 2010.
I have found a code (below) but it does not work and other mention using Query close but I cannot find it in the event tab.
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "You can't close the dialog like this!"
End If
End Sub
Can anyone help? Much appreciated.
janeyg