Table of contents
Collapse the table of content
Expand the table of content

Form.DatasheetFontItalic Property (Access)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

You can use the DatasheetFontItalic property to specify an italicized appearance for field names and data in Datasheet view. Read/write Boolean.


expression. DatasheetFontItalic

expression A variable that represents a Form object.


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 Basicwithin a Microsoft Access database.

The following table contains the properties that don't exist in the DAO Properties collection of 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.

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.


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 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" 
 On Error GoTo 0 
 Set prpProperty = objTableObj.CreateProperty(strPropertyName, _ 
 intPropertyType, varPropertyValue) 
 objTableObj.Properties.Append prpProperty 
 End If 
 End If 
End Sub

See also


Form Object

© 2018 Microsoft