dbc_BeforeAddTable Event

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

PROCEDURE dbc_BeforeAddTable(cTableName, cLongTableName) 

-Or-

PROCEDURE dbc_BeforeAddTable
LPARAMETERS [cTableName, cLongTableName]

Parameters

  • cTableName,
    Specifies the name of the table being added.
  • cLongTableName
    Specifies the long name to be given to the table.

Remarks

You can use the dbc_BeforeAddTable event to execute code before the table is added to a database to accomplish any programming need such as controlling whether or under what conditions a table is may be added to the database, or to log the addition of the table.

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

Return .F. from this procedure to prevent the table from being added to the database.

Example

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) = 'BILLG' && only one user may add tables
   RETURN .T.
ENDIF
   RETURN .F.
ENDIF
ENDPROC

See Also

Enable or Disable DBC Events | dbc_AfterAddTable | dbc_BeforeRemoveTable | dbc_AfterRemoveTable