This example uses the ActualSize and DefinedSize properties to display the defined size and actual size of a field.
'BeginActualSizeVB Public Sub ActualSizeX() Dim rstStores As ADODB.Recordset Dim strCnn As String ' Open a recordset for the Stores table. strCnn = "Provider=sqloledb;" & _ "Data Source=MyServer;Initial Catalog=Northwind;User Id=sa;Password=; " Set rstStores = New ADODB.Recordset rstStores.Open "Suppliers", strCnn, , , adCmdTable ' Loop through the recordset displaying the contents ' of the stor_name field, the field's defined size, ' and its actual size. rstStores.MoveFirst Dim strMessage As String Do Until rstStores.EOF strMessage "Company name: " & rstStores!CompanyName & _ vbCrLf & "Defined size: " & _ rstStores!CompanyName.DefinedSize & _ vbCrLf & "Actual size: " & _ rstStores!CompanyName.ActualSize & vbCrLf MsgBox strMessage, vbOKCancel, "ADO ActualSize Property (Visual Basic)" rstStores.MoveNext Loop rstStores.Close End Sub 'EndActualSizeVB
ActualSize Property | DefinedSize Property | Field Object