Navigation:  DAO Object Classes > DaoQueryDef Class >

DaoQueryDef:Execute() Method

Previous pageReturn to chapter overviewNext page

Purpose

Execute the Querydef (must be non-row returning)

 

Parameters

liOptions(Optional) A constant or combination of constants that determines the data integrity characteristics of the query, as specified in Remarks

 

Returns

NIL

 

Remarks

The Execute method is valid only for action queries. If you use Execute with another type of query, an error occurs. Because an action query doesn't return any records, Execute doesn't return a Recordset. (Executing an SQL pass-through query in an ODBCDirect workspace will not return an error if a Recordset isn't returned.)

 

Use the RecordsAffected

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

property of the QueryDef object to determine the number of records affected by the most recent Execute method. For example, RecordsAffected contains the number of records deleted, updated, or inserted when executing an action query.

 

In an ODBCDirect workspace, if you include the optional dbRunAsync constant, the query runs asynchronously. To determine whether an asynchronous query is still executing, check the value of the StillExecuting property on the object from which the Execute method was called. To terminate execution of an asynchronous Execute method call, use the Cancel method.

 

You can use the following constants for IOptions:

 

ConstantDescription

 

dbDenyWriteDenies write permission to other users (Microsoft Jet workspaces only).
DbInconsistent(Default) Executes inconsistent updates (Microsoft Jet workspaces only).
DbConsistentExecutes consistent updates (Microsoft Jet workspaces only).
DbSQLPassThroughExecutes an SQL pass-through query. Setting this option passes the SQL statement to an ODBC database for processing (Microsoft Jet workspaces only).
DbFailOnErrorRolls back updates if an error occurs (Microsoft Jet workspaces only).
DbSeeChangesGenerates a run-time error if another user is changing data you are editing (Microsoft Jet workspaces only).
DbRunAsyncExecutes the query asynchronously
DbExecDirectExecutes the statement without first calling SQLPrepare ODBC API function

 

Class

DaoQueryDef