Share via


dbc_BeforeAddTable Event

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.

Note   This event does not occur when you create a table in the 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

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

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

See Also

Enable or Disable DBC Events | dbc_AfterAddTable | dbc_BeforeRemoveTable | dbc_AfterRemoveTable