'**** Courtesy code provided by CodeDisk II **** Calvin Smith http://www.CalvinSmithSoftware.com/codedisk/sneakpeek.htm ------------------------------------------------------------ Function DisplayFieldNames(strAnyTableName As String) On Error GoTo ErrorHandling_Err ' --------------------------------------------------- ' Purpose: Example of how to return all field names ' from a table ' ' Accepts: strAnyTableName$ as your table name ' ' Returns: N/A ' ' Example usage: DisplayFieldNames("tblMyTableName") ' --------------------------------------------------- ' Dim ThisDB As Database Dim rsMyRecordSet As Recordset Dim fld As Field Dim iCounter As Integer ' Using the current database Set ThisDB = CurrentDb ' Open your Recordset against your table here Set rsMyRecordSet = ThisDB.OpenRecordset(strAnyTableName$, dbOpenSnapshot) ' Enumerate all fields in the Recordset For iCounter = 0 To rsMyRecordSet.Fields.Count - 1 ' Print the Field name(s) in the Debug window Set fld = rsMyRecordSet.Fields(iCounter) Debug.Print "Field name: " & fld.Name Next iCounter Set rsMyRecordSet = Nothing ErrorHandling_Err: If Err Then 'Trap your error(s) here, if any! End If End Function