Get fields name of table in fields collection (1 Viewer)

FuzMic

DataBase Tinker
Local time
Today, 16:19
Joined
Sep 13, 2006
Messages
719
Hi guys

Another quick shot - i want to loop through all the fields in a table and list out the names.

So i am thinking of the field collection with all the Dim & Set and want a sure quick job done.

I think we can also do it with an recordset.

Will appreciate a quick comparison. Thanks in advance.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 19:19
Joined
Jan 20, 2009
Messages
12,849
One really easy way that displays the fieldnames in a Listbox is to use the FieldList setting of the listbox's RowSourceType. Put the name of the table (or query) in the RowSource.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 03:19
Joined
Feb 28, 2001
Messages
27,001
Essentially anything that behaves like a recordset will have a fields collection. If you have a form bound to a table (as opposed to a query) then Me.Recordset.Fields will work from that form to show you the fields in the table - but only for that one table that is bound.
 

FuzMic

DataBase Tinker
Local time
Today, 16:19
Joined
Sep 13, 2006
Messages
719
Thank you folks. I have just used the .fields associate with recordset.
 

Users who are viewing this thread

Top Bottom