Type Property

Applies To

Module object.

Description

The Type property indicates whether a module is a standard module or a class module.

Setting

The Type property is available only by using Visual Basic and is read-only.

If the module is a standard module, the value of the Type property is acStandardModule or 0. If the module is a class module, the value of the Type property is acClassModule or 1.

Example

The following example determines whether a Module object represents a standard module or a class module:

Function CheckModuleType(strModuleName As String) As Integer
    Dim mdl As Module

    ' Open module to include in Modules collection.
    DoCmd.OpenModule strModuleName
    ' Return reference to Module object.
    Set mdl = Modules(strModuleName)
    ' Check Type property.
    If mdl.Type = acClassModule Then
        ' Insert comment.
        mdl.InsertLines 1, "' Class module."
        CheckModuleType = acClassModule
    Else
        ' Insert comment.
        mdl.InsertLines 1, "' Standard module."
        CheckModuleType = acStandardModule
    End If
End Function