ActualSize, DefinedSize Properties Example
This example uses the ActualSize and DefinedSize properties to display the defined size and actual size of a field.
Public Sub ActualSizeX()
Dim rstStores As ADODB.Recordset
Dim strCnn As String
' Open a recordset for the Stores table.
strCnn = "driver={SQL Server};server=srv;" & _
"uid=sa;pwd=;database=pubs"
Set rstStores = New ADODB.Recordset
rstStores.Open "stores", strCnn
' Loop through the recordset displaying the contents
' of the stor_name field, the field's defined size,
' and its actual size.
With rstStores
.MoveFirst
Do Until .EOF
Debug.Print "Store name: " & !stor_name
Debug.Print "Defined size: " & !stor_name.DefinedSize
Debug.Print "Actual size: " & !stor_name.ActualSize & vbCr
.MoveNext
Loop
.Close
End With
End Sub
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.