J
Joe Williams
I am trying to use an IF statement to check if a form is filled out
correctly. If not, a msgbox is displayed and the form should not be closed.
I can do it with a cmd button, but I am trying to code the IF statement in
the On close event of the form in case the user hits the X to close the form
instead of my command button or closes the form in some other way.
How do I tell the On Close event to cancel if a certain condition is not
met? Here is aircode of what is not working right now. (Doesn't work though,
the cancel = true statemetn does not stop the form from closing)
If me.txtbox <> "1" then
msgbox "You did not fill out the form correctly"
cancel = true
end if
Thanks
Joe
correctly. If not, a msgbox is displayed and the form should not be closed.
I can do it with a cmd button, but I am trying to code the IF statement in
the On close event of the form in case the user hits the X to close the form
instead of my command button or closes the form in some other way.
How do I tell the On Close event to cancel if a certain condition is not
met? Here is aircode of what is not working right now. (Doesn't work though,
the cancel = true statemetn does not stop the form from closing)
If me.txtbox <> "1" then
msgbox "You did not fill out the form correctly"
cancel = true
end if
Thanks
Joe