Results 1 to 3 of 3

Thread: [RESOLVED] Add database table names to combobox

  1. #1

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Resolved [RESOLVED] Add database table names to combobox

    Using access 2000, ado and jet
    How can i add the table names from an access db to a combobox ?
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Add database table names to combobox

    Use the Connection.OpenSchema method to return a variety of database schema information.

    To get a list of tables the code would be

    Code:
        Dim db As ADODB.Connection
        Dim rs As ADODB.Recordset
        
        Set db = New ADODB.Connection
        db.Open "provider=microsoft.jet.oledb.4.0;data source=c:\projects\northwind.mdb"
        
        Set rs = db.OpenSchema(adSchemaTables, Array(Empty, Empty, Empty, "Table"))
        Do Until rs.EOF
            Combo1.AddItem rs.Fields("Table_Name").Value
            rs.MoveNext
        Loop
        
        rs.Close
        db.Close

  3. #3

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Add database table names to combobox

    thanks brucevde
    works perfect
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

Posting Permissions

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



Click Here to Expand Forum to Full Width