dbc_BeforeOpenTable Event
Occurs before a table or view contained in the database is opened. There are two versions of the syntax.
PROCEDURE dbc_BeforeOpenTable(cTableName)
PROCEDURE dbc_BeforeOpenTable
LPARAMETERS cTableName
Parameters
- cTableName
Specifies the name of the table or view being opened.
Remarks
You can use method code in the dbc_BeforeOpenTable event to track attempted access before a table is opened in the database. This event occurs anytime a table or view in the database is opened either explicitly by the USE command or implicitly by other commands such as SELECT.
If the underlying tables are not open when a view is opened, this event occurs for both the tables and the view. The dbc_BeforeOpenTable event receives the name of the table as the parameter and not the cursor name.
Return .F. from this procedure to prevent the table from being opened.
Example
* Reports the method name, where it is called from and the
* value of the paramater cTableName.
PROCEDURE dbc_BeforeOpenTable ;
(cTableName)
? '>> ' + PROGRAM()
?? ' in ' + SUBSTR(SYS(16),RAT('\',SYS(16))+1)
? ' cTableName = ' + TRANSFORM(cTableName) + ' - ' ;
+ TYPE('cTableName')+' /end/ '
ENDPROC
See Also
Tasks
How to: Enable or Disable DBC Events