Stopping unauthorised program exit

  • Thread starter Thread starter Neil Warwick
  • Start date Start date
N

Neil Warwick

In my application I have a form that has some data
validation on it which is done when the user presses a
button to exit the form.
To stop the user from exiting the form illegally I have
disabled the close window icon in the top right of the
window, however the users are still able to exit the
application and form and bypass the error checking by
hitting the close application icon in the top right of the
main access window.

Is there any way I can also disable this button so that it
is impossible to leave the form until all data is valid?

Thanks

Neil
 
If you use the Forms "On Unload" Procedure, you can
control if it is ok to quit/close down the form: -

Try adding the following code: -

Dim CheckData As Boolean
Dim MsgValue
'For each field repeat this code: -
If Me.Field01= "Blah Blah" Then CheckDataOK=True Else
CheckDataOK=False
If CheckDataOK=False Then Cancel=True Else Cancel=False
If Cancel = True Then msgvalue=msgBox("Submitted data does
not comply with data restrictions, check
data.",vbokcancel+vbinformation)
'End Of Code

HTH


Tony C
 
Back
Top