FieldSize Property Example (MDB)
The following example uses the FieldSize property to return the size in bytes of two fields in an Employees table. The Notes field contains Memo data and the Photo field contains Long Binary (OLE Object) data.
Sub GetFieldSize()
Dim dbs As Database, rst As Recordset
Dim fldNotes As Field, fldPhoto As Field
Dim strSQL As String
' Return reference to current database.
Set dbs = CurrentDb
' Construct SQL statement to return Notes and Photo fields.
strSQL = "SELECT Notes, Photo FROM Employees;"
' Create dynaset-type Recordset object.
Set rst = dbs.OpenRecordset(strSQL)
Set fldNotes = rst!Notes
Set fldPhoto = rst!Photo
' Move to first record.
rst.MoveFirst
Debug.Print "Size of Notes:"; " "; "Size of Photo:"
' Print sizes of fields for each record in Recordset object.
Do Until rst.EOF
Debug.Print fldNotes.FieldSize; " "; fldPhoto.FieldSize
rst.MoveNext
Loop
rst.Close
Set dbs = Nothing
End Sub