DatasheetFontName, DatasheetFontHeight, DatasheetFontWeight Properties 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