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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fill combo box with Field Names of a query? 3

Status
Not open for further replies.

ordendelfai

Technical User
Nov 8, 2002
187
US
I have a combo box that contains all of the field names of certain query. Up to this point, I have created a seperate table to hold the field names of the query.

However, I now need a way to dynamically grab all the field names in a query, and populate the combobox with them. The main problem I cannot figure out is how to pull the field names one by one out of a query. Any help is appreciated.

Thanks,



~Joel
As common courtesy and to help other members who might find your thread helpful in the future, please respond if the advice given resolved your issue.
 
What about a Recordset based on the query and then browsing the Fields collection grabbing the Name property ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Here's a query that will list all of the queries in your database:

SELECT MSysObjects.Name
FROM MSysObjects
WHERE (MSysObjects.Type=5);


If you want the combobox to list the fields referenced in the query, then set the RowSourceType Property of the combobox to "Field List" and the RowSource to the name of your query.
 
Oh Man, that is a lot easier then I thought it would be. I didn't realize that combo boxes had a built in feature to get the field names for queries. Thanks so much!!!



~Joel
As common courtesy and to help other members who might find your thread helpful in the future, please respond if the advice given resolved your issue.
 
Thank-you FancyPrairie, very enlightening!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top