Form. DatasheetFontHeight-Eigenschaft (Access)Form.DatasheetFontHeight property (Access)
Sie können die DatasheetFontHeight-Eigenschaft verwenden, um den Schriftgrad in Punkt für die Anzeige und den Druck von Feldnamen und Daten in der Datenblattansicht anzugeben.You can use the DatasheetFontHeight property to specify the font point size used to display and print field names and data in Datasheet view. Ganze Zahl mit Lese-/Schreibzugriff.Read/write Integer.
SyntaxSyntax
Ausdruck. DatasheetFontHeightexpression.DatasheetFontHeight
expression Eine Variable, die ein Form-Objekt darstellt.expression A variable that represents a Form object.
BemerkungenRemarks
Diese Eigenschaft ist nur in Microsoft Access-Datenbanken verfügbar.This property is only available within a Microsoft Access database.
Für die DatasheetFontHeight -Eigenschaft muss der von Ihnen angegebene Schriftgrad für die Schriftart gültig sein, die von der DatasheetFontName -Eigenschaft angegeben wird.For the DatasheetFontHeight property, the font size that you specify must be valid for the font specified by the DatasheetFontName property. So ist die Schriftart MS Sans Serif z. B. in den Punktgrößen 8, 10, 12, 14, 18 und 24 verfügbar.For example, MS Sans Serif is available only in sizes 8, 10, 12, 14, 18, and 24 points.
Die folgende Tabelle enthält die Eigenschaften, die in der DAO- Eigenschaften Sammlung erst vorhanden sind, wenn Sie Sie mithilfe der Symbolleiste Format (Datasheet) festgelegt haben, oder Sie können Sie mithilfe der CreateProperty in einer **** Access-Datenbank (MDB) hinzufügen. -Methode und an die DAO Properties -Auflistung angefügt.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 (.mdb) by using the CreateProperty method and append it to the DAO Properties collection.
Hinweis
Wenn Sie eine mit einem Sternchen aufgeführte Eigenschaft hinzufügen oder festlegen, fügt Microsoft Access automatisch alle mit einem Sternchen aufgeführten Eigenschaften zur Properties-Auflistung der Datenbank hinzu.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.
BeispielExample
Im folgenden Beispiel wird die Schriftart auf MS Serif, die Schriftgröße auf 10 Punkt und die Schriftbreite auf Mittel (500) in der Datenblattansicht der Tabelle Products festgelegt.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.
Sub SetDatasheetFont
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
End Sub
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
Im folgenden Beispiel werden die gleichen Änderungen wie im vorherigen Beispiel in der Datenblattansicht des Formulars Open Products vorgenommen.The following 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
Support und FeedbackSupport and feedback
Haben Sie Fragen oder Feedback zu Office VBA oder zu dieser Dokumentation?Have questions or feedback about Office VBA or this documentation? Unter Office VBA-Support und Feedback finden Sie Hilfestellung zu den Möglichkeiten, wie Sie Support erhalten und Feedback abgeben können.Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.