DatasheetFontName, DatasheetFontHeight Properties

Applies To

Form, Query, Table.

Description

You can use the DatasheetFontName and DatasheetFontHeight properties to specify the font and the font point size used to display field names and data.

Note The DatasheetFontName and DatasheetFontHeight properties apply to all fields in Datasheet view and to form controls when the form is in Datasheet view.

Setting

  • DatasheetFontName — In Visual Basic, you set this property using a string expression equal to the name of the font.
  • DatasheetFontHeight — In Visual Basic, this property setting is an Integer value between 1 and 127 representing the font height in points.

You can set these properties by choosing the font name or font height on the Datasheet Formatting toolbar.

You can also set these properties by clicking Font on the Format menu in Datasheet view.

Remarks

For the DatasheetFontName property, the font names you can specify depend on the fonts installed on your system and for your printer. If you specify a font that your system can’t display or that isn’t installed, Microsoft Windows will substitute a similar font.

For the DatasheetFontHeight property, the point size you specify must be valid for the font specified by the DatasheetFontName property. For example, MS Sans Serif is available in point sizes 8, 10, 12, 14, 18, and 24.

See Also

DatasheetFontItalic, DatasheetFontUnderline Properties; DatasheetFontWeight Property.

Example

The following example sets the font to MS Serif, the point size to 10, 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 db As Database, tdProducts As TableDefdb = CurrentDbtdProducts = db![Products]tdProducts, "DatasheetFontName", vbString, "MS Serif"tdProducts, "DatasheetFontHeight", vbInteger, 10tdProducts, "DatasheetFontWeight", vbInteger, 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"![Products].DatasheetFontHeight = 10![Products].DatasheetFontWeight = 500