CurrentObjectType, CurrentObjectName Properties

CurrentObjectType, CurrentObjectName Properties

See Also         Example         Applies To

You can use the CurrentObjectType and CurrentObjectName properties together with the Application object to determine the type of the active database object (table, query, form, report, macro, module, data access page, server view, database diagram, or stored procedure) and the name of the active database object. The active database object is the object that has the focus or in which code is running.

Setting

The CurrentObjectType property is set by Microsoft Access to one of the following Microsoft Access intrinsic constants.

Setting Description
acTable (0) The active object is a table.
acQuery (1) The active object is a query.
acForm (2) The active object is a form.
acReport (3) The active object is a report.
acMacro (4) The active object is a macro.
acModule (5) The active object is a module.
acDataAccessPage (6) The active object is a data access page.
acServerView (7) The active object is a server view.
acDiagram (8) The active object is a database diagram.
acStoredProcedure (9) The active object is a stored procedure.

The CurrentObjectName property is set by Microsoft Access to a string expression containing the name of the active object.

These properties are available only by using Visual Basic and are read-only in all views.

Remarks

The following conditions determine which object is considered the active object:

You can use these properties with the SysCmd method to determine the active object and its state (for example, if the object is open, new, or has been changed but not saved).