If you are using SQL Server you can use the syscolumns table to be able to generate a list of the columns for the table in question and use that information to populate the column headers.
Code:
SELECT sc.Name as ColumnName
FROM sysobjects so LEFT JOIN syscolumns sc ON so.Id = sc.Id
WHERE so.Type = 'U'
AND so.Name = '<Insert Table Name Here>'
This gives you a list of the fields in the table. If you want to get REALLY smart you can include the datatype into the statement, connect to the systypes table and also determine the width each field needs to be to display ALL the data... but that would triple the complexity of the query
Your alternative is to open a recordset.
Code:
Dim iField as Integer
Dim sMsg as String
Set rstTemp = db.OpenRecordset("TableName",dbOpenSnapshot, dbReadOnly, dbReadOnly)
For iField = 1 to rstTemp.Fields.Count
sMsg = sMsg & "Field called " & rstTemp.Fields(iField).Name & vbCR
< You can assign to the header of this column here>
Next iField
MsgBox sMsg
See how that goes