how to generate a list of all fields in a table (to be added to a listbox)
how to generate a list of all fields in a table (to be added to a listbox)
Re: how to generate a list of all fields in a table (to be added to a listbox)
if you use DAO you can iterate over the Fields collection that's part of the TableDef object.
Re: how to generate a list of all fields in a table (to be added to a listbox)
You could use the fields collection off the recordset object in ADO...
Dim x as Integer
Dim rs as ADODB.Recordset
'get an empty recordset
'select * from table where 1=2
for x = 0 to rs.Fields.Count - 1
ListBox1.AddItem rs.Fields(x).Name
next x
'...
You could also use the OpenSchema method of the connection object, but im not convinced that way is any faster than the above way. It might however, be more memory efficient, I haven't tested it.
John
John Pirkey
MCSD
www.ShallowWaterSystems.com