Function GetColumnNames(strObjectName As String, Optional ShowDetails As Boolean = False) As String 'Returns the names of all columns in the specified table or query
'If ShowDetails = False, the return value is like so:
' ID;Column1;Column2;
'If ShowDetails = True, the return value is like so:
' ID;4;4;Column1;10;100;Column2;4;4;
' In this case,the columns represent the following data:
' Column name ; DAO datatype constant:
' (dbLong = 4, dbText = 10, etc) ; Max bytes per column
With WizHook
WizHook.Key = 51488399 'This is an internal Wizhook key.
'It only needs to be given once per
'user session, but most Wizhook
'functions won't work without it.
If ShowDetails Then


GetColumnNames = .GetInfoForColumns(strObjectName) 'where strObjectName is the table name passed to the function
Else
GetColumnNames = .GetColumns(strObjectName) 'where strObjectName is the table name passed to the function
End If
End With
MsgBox GetColumnNames
End Function

Note: I found this code posted on the web so use at your own risk. There are also other methods to get field names in a table versus the above method.

WizHook is an internal undocumented library for Access wizards in Access 2000 and later.

For more info: http://www.docstoc.com/docs/34838894...hook-Reference