Form.DatasheetFontItalic property (Access)
Use the DatasheetFontItalic property to specify an italicized appearance for field names and data in Datasheet view. Read/write Boolean.
Syntax
expression.DatasheetFontItalic
expression A variable that represents a Form object.
Remarks
The DatasheetFontItalic property applies to all fields in Datasheet view and to form controls when the form is in Datasheet view.
This property is only available in Visual Basic within a Microsoft Access database.
The following table contains the properties that don't exist in the DAO Properties collection until you set them by using the Formatting (Datasheet) toolbar, or you can add them in an Access database by using the CreateProperty method and append it to the DAO Properties collection.
Properties | Properties Continued |
---|---|
DatasheetFontItalic * | DatasheetForeColor * |
DatasheetFontHeight * | DatasheetBackColor |
DatasheetFontName * | DatasheetGridlinesColor |
DatasheetFontUnderline * | DatasheetGridlinesBehavior |
DatasheetFontWeight * | DatasheetCellsEffect |
Note
When you add or set any property listed with an asterisk, Microsoft Access automatically adds all the properties listed with an asterisk to the Properties collection of the database.
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 following 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 Object, objProducts As Object
Const DB_Boolean As Long = 1
Set dbs = CurrentDb
Set objProducts = dbs![Products]
SetTableProperty objProducts, "DatasheetFontItalic", DB_Boolean, True
SetTableProperty objProducts, "DatasheetFontUnderline", DB_Boolean, True
Sub SetTableProperty(objTableObj As Object, 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 Variant
On Error Resume Next ' Don't trap errors.
objTableObj.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 '" & objTableObj.Name & "'", 48, "SetTableProperty"
Else
On Error GoTo 0
Set prpProperty = objTableObj.CreateProperty(strPropertyName, _
intPropertyType, varPropertyValue)
objTableObj.Properties.Append prpProperty
End If
End If
objTableObj.Properties.Refresh
End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.