ADO Cancel Method

Definition and Usage

The Cancel method can cancel the execution of a method call.

The Cancel method can terminate different tasks for different objects. The following table lists the tasks that are terminated when this method is called:

Object Terminated Tasks
Command Execute.

Note: The Options parameter of the Execute method must be set to adAsyncExecute or adAsyncFetch before the Cancel method is called, otherwise a run-time error will occur.

Connection Execute or Open.

Note: The Options parameter of the Open method must be set to adSyncConnect before the Cancel method is called, and the Options parameter of the Execute method must be set to adAsyncExecute or adAsyncFetch before the Execute method is called, otherwise a run-time error will occur.

Record CopyRecord, DeleteRecord, MoveRecord, or Open.
Recordset Open
Stream Open

Syntax

object.Cancel