Cancel Method

See Also    Example    Applies To   

Cancels execution of a pending asynchronous method call (ODBCDirect workspaces only).

Syntax

object.Cancel

The Cancel method syntax has these parts.

Part Description
object A string expression that evaluates to one of the objects in the "Applies To" list.

Remarks

Use the Cancel method to terminate execution of an asynchronous Execute, MoveLast, OpenConnection, or OpenRecordset method call (that is, the method was invoked with the dbRunAsync option). Cancel will return a run-time error if dbRunAsync was not used in the method you're trying to terminate.

The following table shows what task is terminated when you use the Cancel method on a particular type of object.

If object is a This asynchronous method is terminated
Connection Execute or OpenConnection
QueryDef Execute
Recordset MoveLast or OpenRecordset

An error will occur if, following a Cancel method call, you try to reference the object that would have been created by an asynchronous OpenConnection or OpenRecordset call (that is, the Connection or Recordset object from which you called the Cancel method).