Size Property

See AlsoDIAYUM              Example1N7M0FD>Low (Professional Edition Only)

Applies To

Field objectKU5EEE.

Description

Determines the maximum size, in bytes, of a specified Field1L3F0QJ.  Read-only when the Field is a member of the Fields collection17X8LRK of a TableDefK497U in an open Database.  Read/write only in the Professional Edition with a new object not yet appended to a collection, or with an existing Field object in a closed Database.

Syntax

field.Size [ = sizenum ]

Settings

The Size property settings for specific Microsoft Access field data types are:

Size              Type    Description

 

1                   1          True/False

1                   2          Byte

2                   3          Integer

4                   4          Long

8                   5          Currency

4                   6          Single

8                   7          Double

8                   8          Date/Time

1 to 255         10        Text

0                   11        Long Binary

0                   12        Memo

 

Remarks

The Size property is primarily determined by its Type property except for Text fields (type 10).  For Long Binary and Memo fields, the size is always 0.  You can use the FieldSize method to determine the size of the data in a specific record.  For Text fields, you can specify the maximum length of the Field in bytes.  The maximum Size for Text fields is 255.

To specify a Field using the data control, use the Fields collection of the Recordset property, or of a TableDef in the TableDefs collection of the control's Database property.  For example:

HowBig = Data1.Recordset.Fields("PubID").Size
HowBig = Data1.Database.TableDefs("Authors").Fields("LName").Size

 

The maximum size of individual records in Memo and Long Binary fields is limited only by your system resources.

Data Type

Long103F6YL


See Also

Help:

Fields CollectionQ15ZEN

FieldSize MethodKIWBH9

Name Property2016V9P

NewLANNEW

TableDef ObjectK497U

TableDefs Collection2CHOSZ

Type Property2W0IBT5

 

Data Access Guide:

Chapter 2, "Database Management Using Visual Basic"


Size, Type Properties Example (Professional Edition Only)

This example adds a new field to the set of Fields in the Calls table.

Const DB_TEXT = 10                        ' Type = Text.
Dim TempField As New Field                ' Create a new object.
TempField.Name = "Baseball League"        ' Set Field properties.
TempField.Type = DB_TEXT
TempField.Size = 20
' Append the new Field to the Fields collection.
MyDB.TableDefs("Publishers").Fields.Append TempField