WhyMeAndNotYou
MIS
How can I access a table's field name, field type, and field description using a query?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub ListTheFields(strTable As String)
Dim db As DAO.database
Dim rst As DAO.Recordset
Dim strSql As String
Dim intCount As Integer
Set db = CurrentDb
strSql = "SELECT TOP 1 * FROM " & strTable
Set rst = db.openrecordset(strSql, dbopensnapshot)
For intCount = 0 To (rst.Fields.Count - 1)
Debug.Print rst.Fields(intCount).Name
Next intCount
rst.Close
Set rst = Nothing
db.Close
Set db = Nothing
End Sub