Arthur Fuller
artful at rogers.com
Tue Dec 30 15:11:09 CST 2003
Just what the doctor ordered, Drew. Thangya berry much. I wouldn't have thought of doing it this way but it works fine. Added a few debug statements and changed it slightly to sort alphabetically on field name, and now I can bang in a few table names, then cut and paste each result into an Excel spreadsheet. My first guess (I don't write much DAO anymore) was to use tabledefs, but your way works fine. Arthur -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com Sent: Tuesday, December 30, 2003 9:16 AM To: accessd at databaseadvisors.com Subject: RE: [AccessD] ListFields function I'm sure there's another way to do it, but why not: Function FieldNames(strTable as string) As String Dim strSQL As String Dim rs As Recordset Dim strTemp as String Dim i as Long strSQL="SELECT * FROM " & strTable Set rs=CurrentDB.OpenRecordset(strSQL) For i=0 to rs.Fields.Count-1 strTemp=strTemp & rs.Fields(i).Name & vbcrlf Next i FieldNames=strTemp rs.Close set rs=Nothing End Function Drew -----Original Message----- From: Arthur Fuller [mailto:artful at rogers.com] Sent: Tuesday, December 30, 2003 1:08 PM To: AccessD Subject: [AccessD] ListFields function Anyone got a sub that lists the fields of a specified table? I just want something to dump the names into the debug window. Not hard to write but I'm hoping someone can just cut and paste. TIA, Arthur _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com