この例では、NumericScale、Precision プロパティを使って、Pubs データベースの Discounts テーブル内にあるフィールドの小数点の桁数と精度を表示します。
Public Sub NumericScaleX()
Dim rstDiscounts As ADODB.Recordset
Dim fldTemp As ADODB.Field
Dim strCnn As String
' Open recordset.
strCnn = "Provider=sqloledb;" & _
"Data Source=srv;Initial Catalog=Pubs;User Id=sa;Password=; "
Set rstDiscounts = New ADODB.Recordset
rstDiscounts.Open "Discounts", strCnn, , , adCmdTable
' Display numeric scale and precision of
' numeric and small integer fields.
For Each fldTemp In rstDiscounts.Fields
If fldTemp.Type = adNumeric _
Or fldTemp.Type = adSmallInt Then
MsgBox "Field: " & fldTemp.Name & vbCr & _
"Numeric scale: " & _
fldTemp.NumericScale & vbCr & _
"Precision: " & fldTemp.Precision
End If
Next fldTemp
rstDiscounts.Close
End Sub