Results 1 to 2 of 2
  1. #1
    casseopia00 is offline Novice
    Windows Vista Access 97
    Join Date
    Jun 2009
    Posts
    1

    Load tables name and fields name to list box

    hi all,

    i encountered a problem for my school project. i need to load all the table names in my db file to a list box. After selecting the table required in the list box, there will be another list box then display all the fields name in this list box. Then user will be able to select which fields from which tables to see. Is it possible to be done?

  2. #2
    Join Date
    Jun 2009
    Location
    Vietnam
    Posts
    4
    1.Load all the table names in my db file to a list box:

    Code:
    Dim obj As AccessObject, dbs As Object
      Set dbs = Application.CurrentData.AllTables
            
       ListTblName.RowSource = ""
            
        ' Search for open AccessObject objects in AllTables collection.
       For Each obj In dbs
              ListTblName.AddItem obj.Name
       Next obj
    2.After selecting the table required in the list box,another list box then display all the fields name in this list box:
    Code:
    Dim db As DAO.Database
    Dim tdf As DAO.TableDef
    Dim i As Integer
    
    Set db = CurrentDb
    Set tdf = db.TableDefs(ListTblName) 
    
    ListFieldName.RowSource = ""
    
    For i = 0 To tdf.Fields.Count - 1
        ListFieldName.AddItem tdf.Fields(i).Name
    Next


    3.User will be able to select which fields from which tables to see:
    --->
    I don't understand.

    Last edited by hiền muội; 07-01-2009 at 12:31 AM.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 03-31-2009, 09:03 AM
  2. combining fields into a single list
    By rich in forum Queries
    Replies: 4
    Last Post: 02-23-2009, 06:41 AM
  3. Replies: 0
    Last Post: 08-13-2008, 03:15 PM
  4. Query to Display Tables & Fields
    By foxerator in forum Queries
    Replies: 0
    Last Post: 04-24-2008, 09:57 AM
  5. Replies: 1
    Last Post: 06-03-2006, 05:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums