Visual Basic: RDO Data Control

WillExecute Event

See Also    Example    Applies To

Occurs before the execution of a query,

Private Subobject**.WillExecute**(Query as rdoQuery, Cancel as Boolean)

The WillExecute event syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
Query An object expression that evaluates to an rdoQuery object whose query has just completed.
Cancel A Boolean expression indicating if RDO should prohibit the change.

The settings for Cancel are:

Setting Description
True RDO will prohibit the change.
False (Default) RDO will not prohibit the change.

Remarks

This event is fired before the execution of a query, regardless if it is an action or row-returning query. You can trap this event to disallow the execution of certain queries, or to make last-minute adjustments to the rdoQuery object's SQL string.

The Cancel argument allows you to disallow the query. The Cancel parameter will default to False, but if you set it to True, the query will not execute, and RDO generates a trappable error indicating that the query was canceled.

For example, you can pre-screen the query to make sure the WHERE clause will not cause a table-scan operation. Thus, by setting the Cancel argument to True, you can prohibit users from searching for customers with the last name of Smith without also providing a first name or street address.

The WillExecute event fires for all queries execute on this rdoConnection. This includes those queries executed via the OpenResultset or Execute methods, as well as those executed from an associated rdoQuery object. The Query argument is an object reference indicating which query is about to execute. Using this argument, you can write a single event handler for all queries on the connection, but still customize the handler for specific queries. When executing queries against the rdoConnection object itself, RDO creates an rdoQuery object internally, and a reference to this internal rdoQuery is passed as the Query argument.