Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003
    Posts
    328

    Unanswered: Fields in a combo box

    Can someone help me to find a way to view columns from SQL Server tables in a combo box? I don't want the data in the columns, I want the actual column names. I want the user to be able to pick the columns needed and run a query to get the data just from the columns chosen. I think what I need to do is run a SQL Server stored procedure from VB.
    Thanks.
    Last edited by exdter; 02-13-04 at 15:15.

  2. #2
    Join Date
    Feb 2004
    Posts
    37
    Can't remember exactly, you need to use ADO's field object, the code goes something like this:

    open connection to DB.
    open the recordset (lets call it RSRecordset) with a SELECT * FROM tablename.
    dim fldField as adodb.field
    for each fldfield in rsrecordset
    combobox.additem fldfield.name
    next

  3. #3
    Join Date
    Aug 2003
    Posts
    328
    Thanks for your help. I'm going to just manually add the columns after all. I think if I took all the columns it would be too much for the user to look through.
    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •