DatasheetFontItalic, DatasheetFontUnderline Properties

Applies To

Form, Query, Table.

Description

You can use the DatasheetFontItalic and DatasheetFontUnderline properties to specify an italic or underlined appearance for field names and data in Datasheet view.

Note The DatasheetFontItalic and DatasheetFontUnderline properties apply to all fields in Datasheet view and to form controls when the form is in Datasheet view.

Setting

You can set these properties by clicking the Italic or Underline button on the Datasheet Formatting toolbar.

You can also set these properties by clicking Font on the Format menu in Datasheet view.

In Visual Basic, the DatasheetFontItalic property uses the following settings.

Setting Description
True The text is italic.
False (Default) The text isn’t italic.


In Visual Basic, the DatasheetFontUnderline property uses the following settings.

Setting Description
True The text is underlined.
False (Default) The text isn’t underlined.


In Visual Basic, these properties have a data type of Boolean.

See Also

DatasheetFontName, DatasheetFontHeight Properties; DatasheetFontWeight Property.

Example

The following example displays the data and field names in Datasheet view of the Products form as italic and underlined.


Forms![Products].DatasheetFontItalic = True![Products].DatasheetFontUnderline = True

The next example displays the data and field names in Datasheet view of the Products table as italic and underlined.

To set the DatasheetFontItalic and DatasheetFontUnderline properties, the example uses the SetTableProperty procedure, which is in the database’s standard module.


Dim db As Database, tdProducts As TableDefdb = CurrentDbtdProducts = db![Products]tdProducts, "DatasheetFontItalic", dbBoolean, TruetdProducts, "DatasheetFontUnderline", dbBoolean, True
SetTableProperty (TableObj As TableDef, strPropertyName As String, _
        intPropertyType As Integer, varPropertyValue As Variant)
    ' Set Microsoft Access-defined table property without causing
    ' nonrecoverable run-time error.
    Const conErrPropertyNotFound = 3270
    Dim proProperty As Property
    On Error Resume Next                ' Don't trap errors.
    TableObj.Properties(strPropertyName) = varPropertyValue
    If Err <> 0 Then                    ' Error occurred when value set.
        If Err <> conErrPropertyNotFound Then
            On Error GoTo 0
            MsgBox "Couldn't set property '" & strPropertyName _
                & "' on table '" & TableObj.name & "'", 48, _
                & "SetTableProperty"
        Else
            On Error GoTo 0
            Set proProperty = TableObj.CreateProperty(strPropertyName, _
                intPropertyType, varPropertyValue)
            TableObj.Properties.Append proProperty
        End If
    End If
    TableObj.Properties.RefreshSub