Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OOPS!! I didn't mean to click Close Button

Status
Not open for further replies.

mikelt

Programmer
Jul 4, 2000
14
GB
If a user clicks the Close Button of a form you can put code into the On Close event to check if specific data fields have been entered but how do you then stop the form from closing and take the user back to the partially completed form?

Any help would be appreciated.

Thanks
mikelt

 
Study the help on the CancelEvent method. Also the Undo method might be useful if you want to set the form back to how it before a record was edited.

As an example you use code like this in the OnClose event:

If IsNull([Important_field]) then
CancelEvent
end if

Also you should consider setting the Validation property for reuired fields to force valid entry before a record can be saved.

Rod

 
Another route, you can disable that close button in the upper right hand corner, and have a command button that exits out of the form (after verification of course).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top