Share via


dbc_Deactivate Event

Occurs when a database ceases to be active.

PROCEDURE dbc_Deactivate(cDatabaseName) 

-Or-

PROCEDURE dbc_Deactivate
LPARAMETERS cDatabaseName

Parameters

  • cDatabaseName
    Specifies the name of the database being deactivated.

Remarks

You can have many Databases open at the same time but only one can be active at a time. Several situations can deactivate a database. To explicitly deactivate a database without activating another database, use the SET DATABASE TO command without arguments.

If several databases (with DBC Events turned on) are open, when one is deactivated the dbc_Deactivate method in that database is executed.

If you place DBC Events code in a program file, the code applies to any database that specifies that program file as its events file. In such program code, use the cDatabaseName parameter to determine which database called the event. This way, you can use one block of method code to determine the deactivated database and then apply code appropriate to that database.

Return .F. from this procedure to prevent the database from being deactivated. Because closing a database implicitly deactivates it, this will also prevent the database from being closed.

Example

PROCEDURE dbc_Deactivate ;
         (cDatabaseName)
? '     cDatabaseName = ' + TRANSFORM(cDatabaseName) + ' - ' ;
                      + TYPE('cDatabaseName')+' /end/ '
ENDPROC

See Also

dbc_Activate DBC Event | SET DATABASE Command | dbc_CloseData Event | dbc_ModifyData Event | dbc_OpenData Event