Applies To Form object, QueryDef object, TableDef object.
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 button or the Underline button on the Formatting (Datasheet) toolbar.
You can also set these properties in the Font dialog box, available by clicking Font on the Format menu in Datasheet view. In Visual Basic, the DatasheetFontItalic property uses the following settings.Setting | Description |
True (–1) | The text is italic. |
False (0) | (Default) The text isn't italic. |
Setting | Description |
True | The text is underlined. |
False | (Default) The text isn't underlined. |
|
|
| DatasheetFontItalic* |
|
|
|
|
|
|
See Also BackColor property, DatasheetBackColor, DatasheetForeColor properties, DatasheetCellsEffect property, DatasheetFontName, DatasheetFontHeight properties, DatasheetFontWeight property, DatasheetGridlinesBehavior property, DatasheetGridlinesColor property, ForeColor 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
Forms![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 dbs As Database, tdfProducts As TableDef
Set dbs = CurrentDb
Set tdfProducts = dbs![Products]
SetTableProperty tdfProducts, "DatasheetFontItalic", dbBoolean, True
SetTableProperty tdfProducts, "DatasheetFontUnderline", dbBoolean, True
Sub SetTableProperty(tdfTableObj 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 prpProperty As Property
On Error Resume Next ' Don't trap errors.
tdfTableObj.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 '" & tdfTableObj.Name & "'", 48, _
"SetTableProperty"
Else
On Error GoTo 0
Set prpProperty = tdfTableObj.CreateProperty(strPropertyName, _
intPropertyType, varPropertyValue)
tdfTableObj.Properties.Append prpProperty
End If
End If
tdfTableObj.Properties.Refresh
End Sub