Freigeben über


Field.Size-Eigenschaft (DAO)

Gilt für: Access 2013, Office 2013

Legt einen Wert fest, der die maximale Größe eines Field -Objekts in Byte angibt, oder gibt den betreffenden Wert zurück.

Syntax

Ausdruck . Größe

Ausdruck Eine Variable, die ein Field-Objekt darstellt.

Bemerkungen

Bei einem Objekt, das noch nicht der Fields -Auflistung angefügt wurde, besteht für diese Eigenschaft Lese-/Schreibzugriff.

Bei Feldern (außer Memofeldern), die Zeichendaten enthalten, gibt die Size-Eigenschaft die maximale Anzahl von Zeichen an, die ein Feld enthalten kann. For numeric fields, the Size property indicates how many bytes of storage are required.

Die Verwendung der Size-Eigenschaft hängt von dem Objekt ab, das die Fields-Auflistung enthält, an die das Field-Objekt angehängt ist, wie in der folgenden Tabelle dargestellt.

Zugehörigkeit zu Objekt

Verwendung

Index

Nicht unterstützt

QueryDef

Schreibgeschützt

Recordset

Schreibgeschützt

Relation

Nicht unterstützt

TableDef

Schreibgeschützt

When you create a Field object with a data type other than Text, the Type property setting automatically determines the Size property setting; you don't need to set it. For a Field object with the Text data type, however, you can set Size to any integer up to the maximum text size (255 for Microsoft Access databases). If you do not set the size, the field will be as large as the database allows.

For Long Binary and Memo Field objects, Size is always set to 0. Use the FieldSize property of the Field object to determine the size of the data in a specific record. The maximum size of a Long Binary or Memo field is limited only by your system resources or the maximum size that the database allows.

Beispiel

This example demonstrates the Size property by enumerating the names and sizes of the Field objects in the Employees table.

    Sub SizeX() 
     
     Dim dbsNorthwind As Database 
     Dim tdfEmployees As TableDef 
     Dim fldNew As Field 
     Dim fldLoop As Field 
     
     Set dbsNorthwind = OpenDatabase("Northwind.mdb") 
     Set tdfEmployees = dbsNorthwind.TableDefs!Employees 
     
     With tdfEmployees 
     
     ' Create and append a new Field object to the 
     ' Employees table. 
     Set fldNew = .CreateField("FaxPhone") 
     fldNew.Type = dbText 
     fldNew.Size = 20 
     .Fields.Append fldNew 
     
     Debug.Print "TableDef: " & .Name 
     Debug.Print " Field.Name - Field.Type - Field.Size" 
     
     ' Enumerate Fields collection; print field names, 
     ' types, and sizes. 
     For Each fldLoop In .Fields 
     Debug.Print " " & fldLoop.Name & " - " & _ 
     fldLoop.Type & " - " & fldLoop.Size 
     Next fldLoop 
     
     ' Delete new field because this is a demonstration. 
     .Fields.Delete fldNew.Name 
     
     End With 
     
     dbsNorthwind.Close 
     
    End Sub