VB Snippet - Determine Database Field Type
VB Code:
Sub FieldExample()
Dim rs As ADODB.Recordset
Dim fld As ADODB.Field
Set rs = New ADODB.Recordset
' Open the recordset, specifying an SQL statement
' and a connection string.
rs.Open "Select * from authors", "DSN=pubs;UID=sa"
Debug.Print "Fields in Authors Table:" & vbCr
' Loop through each Field object in the
' Fields collection of the table and display properties.
For Each fld In rs.Fields
Debug.Print "Name: " & fld.Name & vbCr & _
"Type: " & fld.Type & vbCr & _
"Value: " & fld.Value
Next fld
' Close the recordset.
rs.Close
End Sub