canClose
Event fired when there’s an attempt to deactivate a query or stored procedure; return value determines if the object is deactivated.
Parameters
none
Property of
Query, StoredProc
Description
If the active property of a Query or StoredProc object is set to false, that object’s canClose event fires. If the canClose event handler returns false, the close attempt fails and the active property remains true.
A StoredProc object may be deactivated only if it returns a rowset. If it returns values only, the active property is automatically reset to false after the stored procedure is called; there is nothing to deactivate.
Normally when a Query or StoredProc object closes, it saves any changes in its rowset’s row buffer, if any. In attempting to save those changes, the rowset’s canSave event is also fired, before canClose. If canSave returns false, the row is not saved, and the object is not closed.
If you want to abandon uncommitted changes instead of saving them when closing the object, call the rowset’s abandon( ) method before closing.