Results 1 to 5 of 5

Thread: Need list of fields of table in print

  1. #1
    Join Date
    Sep 2009
    Posts
    1

    Need list of fields of table in print

    Hi,

    I am merging 2 databases. I have 4 different tables & I want them to work as 1 in new database. How can I just print a list of fields from each table to configure the new table & make required changes.
    I don't know where to start.
    Any help would be appreciated.

  2. #2
    Join Date
    Apr 2008
    Posts
    60

    Re: Need list of fields of table in print

    Built-in documenter on the Tools menu. It's on the Database Tools tab of the ribbon.

    Use this query to return the local tables:

    Code:
    SELECT MsysObjects.Name FROM MsysObjects
        WHERE (([Type] = 1) AND ([Name] Not Like "~*")
            AND ([Name] Not Like "MSys*"))
        ORDER BY MsysObjects.Name;
    Hope this helps.

  3. #3
    Join Date
    May 2008
    Posts
    248

    Re: Need list of fields of table in print

    Have you tried the documentor?
    Use this:

    Code:
        Dim aField As DAO.Field
        Dim aTable As DAO.TableDef
        For Each aTable In CurrentDb.TableDefs
            Debug.Print aTable.Name
            For Each aField In aTable.Fields
                Debug.Print "-" & aField.Name
            Next
        Next

  4. #4
    Join Date
    May 2008
    Posts
    42

    Re: Need list of fields of table in print

    Try Tools>Analyze>Documentor

    I think you need to go through this document from Microsoft

    How to List the Fields in a Table Using the Fields Collection

    # Start a new project in Visual Basic. Form1 is created by default.
    # Add two list boxes to Form1.
    # Double-click the form to open the code window. Add the following code to the Form
    Load event:
    Code:
    Sub Form_Load ()
    
          Set MyDb = OpenDatabase("BIBLIO.MDB")
          ' Set AllTableDefs to definitions of all tables in the database:
          Set AllTableDefs = MyDb.TableDefs
          ' Display names of all tables in database:
          For j = 0 To AllTableDefs.Count - 1
             List1.AddItem AllTableDefs(j).Name
          Next
    
       End Sub
    # Double-click the List1 list box and enter the following code in its Click event:
    Code:
    Sub List1_Click ()
    
          ' Delete any existing entries in List2 box:
           Do While list2.ListCount > 0
              list2.RemoveItem 0
           Loop
    
          ' Get the definition of the single table currently selected in List1:
          Set SingleTableDef = MyDb(List1.List(List1.ListIndex))
          ' Display the properties of each field in the table:
          For j = 0 To SingleTableDef.Fields.Count - 1
             list2.AddItem "Field item number " & Val(j) & ":"
    
             ' Display the name of the field in the table selected in List1:
             list2.AddItem SingleTableDef.Fields(j).Name
             ' or use the following since Fields are the default collection:
             ' List2.AddItem SingleTableDef(j).Name
    
             list2.AddItem SingleTableDef.Fields(j).Size  ' Size of field.
             list2.AddItem SingleTableDef.Fields(j).Type  ' Type of field.
             ' If field is an index, list the name of the index:
             If j <= SingleTableDef.Indexes.Count - 1 Then
                list2.AddItem "Index name: " & SingleTableDef.Indexes(j).Name
             End If
    
             ' The Value property is only valid if part of a recordset:
             ' list2.AddItem SingleTableDef.Fields(i).Value
    
             ' The other 5 properties are valid for a field of TableDef object:
             list2.AddItem SingleTableDef.Fields(j).OrdinalPosition
             list2.AddItem SingleTableDef.Fields(j).CollatingOrder
             list2.AddItem SingleTableDef.Fields(j).Attributes
             list2.AddItem SingleTableDef.Fields(j).SourceField
             list2.AddItem SingleTableDef.Fields(j).SourceTable
             list2.AddItem " "
          Next
    
       End Sub
    # From the File menu, choose New Module. Then enter the following code in the General Declarations section:
    Code:
     Global MyDb As Database
       Global SingleTableDef As TableDef
       Global AllTableDefs As TableDefs
    # Start the program. Click any table name in the first list box. In the second list box, the program displays all the fields and field properties for that table. Close the form to end the program. NOTE: Some MSys* tables (such as MSysACEs) have no fields.

  5. #5
    Join Date
    Apr 2008
    Posts
    35

    Re: Need list of fields of table in print

    You can try Jeff Conrad's free add-in utility:

    http://www.accessmvp.com/JConrad/acc.../csdtools.html

Similar Threads

  1. What is the program to print table of given number?
    By Roxy_jacob in forum Software Development
    Replies: 5
    Last Post: 04-09-2011, 10:40 PM
  2. Print multiplication table
    By MaryJ in forum Software Development
    Replies: 1
    Last Post: 19-11-2010, 10:26 PM
  3. Print Nx2 square table
    By MaryJ in forum Software Development
    Replies: 1
    Last Post: 19-11-2010, 10:16 PM
  4. How to print a Gantt Chart view without table information?
    By Leoniee in forum Windows Software
    Replies: 5
    Last Post: 19-03-2010, 04:35 AM
  5. Replies: 3
    Last Post: 16-11-2009, 12:29 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,497,440.27866 seconds with 16 queries