help with table design for Code Library

Discussion in 'Access Table Design' started by Jan T, Apr 4, 2012.

  1. Jan T

    Jan T Guest

    Hi. I am using MS Access 2010 and want to build a database for
    organizing my Code snippets and functions. I'd like to have different
    categories and subcategories in a form where I can build a tree-view
    kontroll on the very left side of the form. Then, when clicking in the
    tree, I want the relevant function names og procedure names appear in
    a table on the right side. Clicking that sub- or functionname, will
    make a new modular form, with the actual code, Show.

    My question is how do I build the tables.

    I started with two tables, one called tblCode with the following
    fields:
    ID
    HeaderID
    CodeName
    CodeText
    AuthorName

    and another table I named tblHeadings;
    HeadingID
    Heading

    How should I design the tables so that I can have a functioning tree
    with headings like:

    Excel
    |____ Worksheet
    |____ Cell
    |____ Fonts
    |____ Functions
    Outlook
    |____ Mail
    |____ Task
    |____ Contact
    |____ Exporting/Importing
    |____ Appoiment

    Any help is very much appriciated. Thanx in advance!

    Regards
    Jan T.
     
    Jan T, Apr 4, 2012
    #1
    1. Advertisements

  2. Hi Jan

    You would need a minimum 3 tier table approach.

    Change the TierNames to suit your need

    Table.1
    txtTier1Id 'example = 1
    txtAppName 'example = Excel

    Table.2
    txtTier1Id 'example = 1
    txtTier2ID 'example = 1
    txtTier2Name 'example = Worksheet

    Table.3
    txtTier2ID 'example = 1
    txtTier3ID 'example = 1
    txtTier3Name 'example = Cell

    .......................................................

    Table.1
    txtTier1Id 'example = 1
    txtAppName 'example = Excel

    Table.2
    txtTier1Id 'example = 1
    txtTier2ID 'example = 2
    txtTier2Name 'example = Worksheet

    Table.3
    txtTier2ID 'example = 2
    txtTier3ID 'example = 2
    txtTier3Name 'example = Fonts

    .......................................................

    Table.1
    txtTier1Id 'example = 1
    txtAppName 'example = Excel

    Table.2
    txtTier1Id 'example = 1
    txtTier2ID 'example = 2
    txtTier2Name 'example = Worksheet

    Table.3
    txtTier2ID 'example = 2
    txtTier3ID 'example = 3
    txtTier3Name 'example = Functions

    ...........................................................

    Each tier will filter off the previous tier, Etc..... Depending on how
    many tiers you want to go.

    each of your tiers should only need to be a text field, with the
    exception of the actual code field as you would most likely need to use
    a memo field due to the 255 char restriction in text fields.

    Base your Parent form on Table.1, then each of the sub forms on each
    tiers table.2, table.3 etc.....

    I can't help you with a fancy tree view but this should get you started
    in the right direction.

    HTH
    Mick.
     
    Vacuum Sealed, Apr 5, 2012
    #2
    1. Advertisements

  3. Jan T

    Jan T Guest

    Hm, I found that a little static and may be I don't get it.
    This treeview must be dynamic, that is, it must be no
    problem to have only one or more than tree levels.

    But thank you anyway for taking the time.

    May be if I find a solution I would like to share it in this group.
    So I search on the net and found excactly what I was looking for.

    I will bulid my table like the table Employees in the Nortwind.mdb
    where Employees have a field RefersTo. I then will implement
    this idéa in my own project.

    For more information se the following article:
    http://support.microsoft.com/kb/209891/

    So, to make a form, I placed the Microsoft Treeview Contol 6 to
    the left of the form, and then a multiline text box to the right of
    the
    Userform. When clicking one of the nodes in the tree, the
    corresponding code is displayed in the text box to the right.

    The table design is therefor going to be like this I guess:

    tblCode
    ID
    HeaderID
    CodeName
    CodeText
    AuthorName

    And it is all in one single table. Hope this work. Have not
    tested it yet.

    BTW what does HTH stands for? (I always wondered?)

    Regards Jan T.
     
    Jan T, Apr 9, 2012
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.