Show field name, type and value data type
Sub rec_fields()
Dim conn As New Connection
Dim rec As New Recordset
Dim f As Field
Dim ws As Worksheet
Dim i&
Set ws = ThisWorkbook.Worksheets("fields")
conn.Open "Provider=microsoft.jet.oledb.4.0;" + _
"Data Source=" + ThisWorkbook.Path + "\nwind.mdb;"
rec.Open "employees", conn
For Each f In rec.Fields
i = i + 1
ws.[a1].Cells(i) = f.Name
ws.[b1].Cells(i) = f.Type
ws.[c1].Cells(i) = TypeName(f.Value)
Next
rec.Close: conn.Close
End Sub
Related examples in the same category