dbc_Activate Event
Occurs when a database becomes active.
PROCEDURE dbc_Activate(cDatabaseName)
-Or-
PROCEDURE dbc_Activate
LPARAMETERS cDatabaseName
Parameters
- cDatabaseName
Specifies the name of the database being activated.
Remarks
You can have many Databases open at the same time but only one can be active at a time. A database can become active under several circumstances. To explicitly activate a database, use the SET DATABASE TO command. If several databases (with DBC Events turned on) are open, the dbc_Activate method runs only in the active database.
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 this case, DBC events method code can affect several databases at the same time. When you use DBC events in this way, use the cDatabaseName parameter in the event code to specify which database is being activated. This way you can use one block of method code to determine the activated database and then apply code appropriate to that database.
Return .F. from this procedure to prevent the database from being activated.
Example
PROCEDURE dbc_Activate ;
(cDatabaseName)
? ' cDatabaseName = ' + TRANSFORM(cDatabaseName) + ' - ' ;
+ TYPE('cDatabaseName ')+' /end/ '
ENDPROC
See Also
dbc_Deactivate Event | SET DATABASE Command | dbc_CloseData Event | dbc_ModifyData Event | dbc_OpenData Event