DatasheetFontWeight Property

Microsoft Access Visual Basic

expression.DatasheetFontWeight

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

Remarks

The DatasheetFontWeight property applies to all fields in Datasheet view and to form controls when the form is in Datasheet view.

These properties are only available in Visual Basic within a Microsoft Access database (.mdb)

In Visual Basic, the DatasheetFontWeight property setting uses the following Integer values.

Setting Description
100 Thin
200 Extra Light
300 Light
400 (Default) Normal
500 Medium
600 Semi-bold
700 Bold
800 Extra Bold
900 Heavy

The following setting information applies to both Access databases (.mdb) and Access projects (.adp):

  • You can also set Normal and Bold for this property in the Font dialog box, available by clicking Font on the Format menu in Datasheet view. In the Font dialog box's Font Style box, the only available font weight settings are Regular (identical to Normal) and Bold.

  • Another method of setting only the Regular and Bold settings is to click Bold on the Formatting (Datasheet) toolbar.

  • You can set the default DatasheetFontWeight property by using the settings under Default Font on the Datasheet tab of the Options dialog box, available by clicking Options on the Tools menu.

Remarks

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 (.mdb) 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.

Example

The following example sets the font to MS Serif, the font size to 10 points, and the font weight to medium (500) in Datasheet view of the Products table.

To set these properties, the example uses the SetTableProperty procedure, which is shown in the DatasheetFontItalic, DatasheetFontUnderline properties example.

Dim dbs As Object, objProducts As Object
Set dbs = CurrentDb
Const DB_Text As Long = 10
Const DB_Integer As Long = 3
Set objProducts = dbs!Products
SetTableProperty objProducts, "DatasheetFontName", DB_Text, "MS Serif"
SetTableProperty objProducts, "DatasheetFontHeight", DB_Integer, 10
SetTableProperty objProducts, "DatasheetFontWeight", DB_Integer, 500
		

The next example makes the same changes as the preceding example in Datasheet view of the open Products form.

Forms!Products.DatasheetFontName = "MS Serif"
Forms!Products.DatasheetFontHeight = 10
Forms!Products.DatasheetFontWeight = 500