Here you go:
<pre>Option Compare Database
Option Explicit
Public Function PrintFieldsADO(strTableName As String)
Dim rst As ADODB.Recordset
Dim conn As Connection
Dim lngI As Long
Set rst = New ADODB.Recordset
rst.Open strTableName, CurrentProject.Connection, adOpenForwardOnly
With rst
For lngI = 0 To .Fields.Count - 1
Debug.Print .Fields(lngI).Name
Next lngI
.Close
End With
Set rst = Nothing
End Function
Public Function PrintFieldsDAO(strTableName As String)
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim lngI As Long
Set db = CurrentDb
Set rst = db.OpenRecordset(strTableName, dbOpenForwardOnly)
With rst
For lngI = 0 To .Fields.Count - 1
Debug.Print .Fields(lngI).Name
Next lngI
.Close
End With
Set rst = Nothing
End Function</pre>
HTH,
Russell