DefaultValue Property

       

Returns or sets a Variant that defines the default value of the field. Read/write.

expression.DefaultValue

expression   Required. An expression that returns one of the objects in the Applies To list.

Remarks

The default value of all pre-populated fields is Empty.

Example

The following example displays the names of all fields in the list and their associated default values. If the active web does not contain any lists, a message is displayed to the user.

Sub FieldDefaultValue()
'Display the default value of the field

    Dim objApp As FrontPage.Application
    Dim objField As ListField
    Dim strType As String

    Set objApp = FrontPage.Application

    If Not ActiveWeb.Lists Is Nothing Then
        'Display fields in first list of collection
        For Each objField In objApp.ActiveWeb.Lists.Item(0).Fields
            If strType = "" Then
                'if first value in string
                strType = objField.Name & "  -  " & _
                objField.DefaultValue & vbCr
            Else
                'add value to string
                strType = strType & objField.Name & "  -  " & _
                objField.DefaultValue & vbCr
            End If
        Next objField
        MsgBox "The names of the fields in this list and their default" & _
                     " values are: " & vbCr & strType
    Else
        'Otherwise display message to user
        MsgBox "The current web contains no lists."
    End If
End Sub