[AccessD] ListFields function

DWUTKA at marlow.com DWUTKA at marlow.com
Tue Dec 30 11:15:49 CST 2003


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


More information about the AccessD mailing list