Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT FIELDNAMES FROM TABLE???? 1

Status
Not open for further replies.

crowsario

Programmer
Jul 23, 2001
24
US
Does anyone out there know how to select the fieldnames from an access table? I need to fill a list box in my VB front end with the fieldnames from an access table.

Anyone?...Anybody?....Anybody?....Anyone?

thanks
-Crow
 
Sorry I should have been a little more specific...I need to do this using a sql_statement that retireves an adodb.recordset so the .FieldName function will not work.

Thanks for the post though igk.
-Crow
 
Ok I actually ended up solving this one....igk pointed me in the right direction but with an adodb.recordset there is no .FieldName property. what I had to do is:

do until x =recordset.fields.count-1
list1.additem recordset.Fields(x).name
x=x+1
loop

after running my select statement...."select * from tablename"
I'm not sure how this will work when there is no data returned from the query but it's a start nonetheless.

-Crow
 
Hi Crow!

In Access the list box's row source type can be set to field list. Then it will automatically list the fields for the row source.

hth
Jeff Bridgham
 
Thanks Jebry,
Unfortunately I am using a VB frontend....my original thoughts for posting to this forum was that I could right a SQL statement that Access could understand that would return the names of the fields. Instead I played with VB methods to achieve the same.
Thanks anyways
-Crow
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top