dbc_BeforeAddTable Event

JavaScript Editor js editor     Web development 



Main Page

Occurs before an existing free table is added to the active database.

You can use the dbc_BeforeAddTable event to execute code before the table is added to a database. This is useful for programming needs such as controlling whether or under what conditions a table is added to the database or to log the addition of the table. There are two versions of the syntax.

Note:
This event does not occur when you create a table in the database.

PROCEDURE dbc_BeforeAddTable(cTableName, cLongTableName) 
PROCEDURE dbc_BeforeAddTable
LPARAMETERS [cTableName, cLongTableName]

Parameters

cTabl eName,


Specifies the name of the table being added.
cLongTableName


Specifies the long name to be given to the table.

Remarks

To prevent the table from being added to the database, return a value of False (.F.) from this procedure.

Example

В Copy Code
PROCEDURE dbc_BeforeAddTable ;
         (cTableName, ;
          cLongTableName)
? '     cTableName     = ' + TRANSFORM(cTableName)     + ' - ' ;
                       + TYPE('cTableName ')
? '     cLongTableName = ' + TRANSFORM(cLongTableName) + ' - ' ;
                       + TYPE('cLongTableName ')
userID      = SUBSTR(SYS(0),AT('#',SYS(0))+2)
IF UPPER(userID) = 'MYALIAS'   && only one user can add tables.
   RETURN .T.
ENDIF
   RETURN .F.
ENDIF
ENDPROC

See Also



JavaScript Editor js editor     Web development