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:
Constant | Description |
dbDenyWrite | Denies write permission to other users (Microsoft Jet workspaces only). |
DbInconsistent | (Default) Executes inconsistent updates (Microsoft Jet workspaces only). |
DbConsistent | Executes consistent updates (Microsoft Jet workspaces only). |
DbSQLPassThrough | Executes an SQL pass-through query. Setting this option passes the SQL statement to an ODBC database for processing (Microsoft Jet workspaces only). |
DbFailOnError | Rolls back updates if an error occurs (Microsoft Jet workspaces only). |
DbSeeChanges | Generates a run-time error if another user is changing data you are editing (Microsoft Jet workspaces only). |
DbRunAsync | Executes the query asynchronously |
DbExecDirect | Executes the statement without first calling SQLPrepare ODBC API function |
Class