VB Code:
  1. Sub FieldExample()
  2.  
  3.    Dim rs As ADODB.Recordset
  4.  
  5.    Dim fld As ADODB.Field
  6.  
  7.    Set rs = New ADODB.Recordset
  8.  
  9.    ' Open the recordset, specifying an SQL statement
  10.    ' and a connection string.
  11.  
  12.    rs.Open "Select * from authors", "DSN=pubs;UID=sa"
  13.    
  14.    Debug.Print "Fields in Authors Table:" & vbCr
  15.  
  16.    ' Loop through each Field object in the
  17.  
  18.    ' Fields collection of the table and display properties.
  19.  
  20.    For Each fld In rs.Fields
  21.  
  22.       Debug.Print "Name:  " & fld.Name & vbCr & _
  23.  
  24.             "Type:  " & fld.Type & vbCr & _
  25.             "Value: " & fld.Value
  26.  
  27.    Next fld
  28.  
  29.    ' Close the recordset.
  30.  
  31.    rs.Close
  32.  
  33. End Sub