Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Subform with one to many relationship

Discussion in 'Information Technology' started by dBNovice, Jul 28, 2006.

  1. dBNovice

    dBNovice
    Expand Collapse
    Guest

    Hello all, I posted this question previously but did not get suffient
    help. (perhaps my question was not worded properly; hopefully this is
    better) If possible, I really need help on this one............

    I have 3 tables and corresponding forms: tasks, subtasks and elements.
    subtasks is a subform of tasks and elements is a subform of subtasks.
    I have all 3 forms on a tab control with 3 pages. There is a one to
    many relationship with task <-> subtasks; subtasks <-> elements and
    task <-> elements. I am able to insert a task and 1 associated subtask
    and 1 element. The problem exists when I try to put multiple subtasks
    and elements associated with one task. Is there a way to navigate to a
    new record and automatically set the value of either the taskID on the
    Subtasks subform or subtaskID on the Elements subform to link the new
    subform/element to the initial Task. (i.e. I want to input a task w/
    TaskID: 111 and a subtask with TaskID: 111 and SubtaskID: 01 and
    another subtask with TaskID: 111 and SubtaskID: 02; then an element
    with TaskID: 111 and SubtaskID: 01 and ElementID: 1 and another element
    with TaskID: 111 and SubtaskID: 01 and ElementID: 2.

    On the Subtasks subform: Link Child Fields...TaskID and the Link Master
    Fields...Tasks.TaskID

    On the Elements subform: Link Child Fields...SubtaskID and the Link
    Master Fields...Subtasks.SubtaskID

    Note: not all tasks have multiple subtasks or elements; a task could
    have 0 subtask but must have an element (element contains due date).
     
  2. Loading...

    Similar Threads Forum Date
    Reglion Many Lives, Many Masters - A Case For Reincarnation? Book Reviews & Editorials Jun 6, 2016
    How many times? Blogs Oct 16, 2015
    How many different types of Sikhs are there? Sikh Sikhi Sikhism Jul 8, 2014
    India The many British connections to massacres of Sikhs Breaking News Mar 29, 2014
    Learn Punjabi How Many At SPN Are Learning Punjabi? Language, Arts & Culture Nov 14, 2013

  3. aaron.kempf@gmail.com

    aaron.kempf@gmail.com
    Expand Collapse
    Guest

    do you keep subtasks and elements in the same table?

    if not then you should have 2 subforms.

    almost all subforms are based on a one to many relationship.. shoudl be
    pretty cut and dry.

    Are you hoping to set up your subform in datasheet view?

    go into the subform and set the default view to datasheet then

    -Aaron



    dBNovice wrote:
    > Hello all, I posted this question previously but did not get suffient
    > help. (perhaps my question was not worded properly; hopefully this is
    > better) If possible, I really need help on this one............
    >
    > I have 3 tables and corresponding forms: tasks, subtasks and elements.
    > subtasks is a subform of tasks and elements is a subform of subtasks.
    > I have all 3 forms on a tab control with 3 pages. There is a one to
    > many relationship with task <-> subtasks; subtasks <-> elements and
    > task <-> elements. I am able to insert a task and 1 associated subtask
    > and 1 element. The problem exists when I try to put multiple subtasks
    > and elements associated with one task. Is there a way to navigate to a
    > new record and automatically set the value of either the taskID on the
    > Subtasks subform or subtaskID on the Elements subform to link the new
    > subform/element to the initial Task. (i.e. I want to input a task w/
    > TaskID: 111 and a subtask with TaskID: 111 and SubtaskID: 01 and
    > another subtask with TaskID: 111 and SubtaskID: 02; then an element
    > with TaskID: 111 and SubtaskID: 01 and ElementID: 1 and another element
    > with TaskID: 111 and SubtaskID: 01 and ElementID: 2.
    >
    > On the Subtasks subform: Link Child Fields...TaskID and the Link Master
    > Fields...Tasks.TaskID
    >
    > On the Elements subform: Link Child Fields...SubtaskID and the Link
    > Master Fields...Subtasks.SubtaskID
    >
    > Note: not all tasks have multiple subtasks or elements; a task could
    > have 0 subtask but must have an element (element contains due date).
     
  4. Amy Blankenship

    Amy Blankenship
    Expand Collapse
    Guest

    "dBNovice" <luv4nrt@hotmail.com> wrote in message
    news:1149700665.850779.185990@g10g2000cwb.googlegroups.com...
    > Hello all, I posted this question previously but did not get suffient
    > help. (perhaps my question was not worded properly; hopefully this is
    > better) If possible, I really need help on this one............
    >
    > I have 3 tables and corresponding forms: tasks, subtasks and elements.
    > subtasks is a subform of tasks and elements is a subform of subtasks.
    > I have all 3 forms on a tab control with 3 pages. There is a one to
    > many relationship with task <-> subtasks; subtasks <-> elements and
    > task <-> elements. I am able to insert a task and 1 associated subtask
    > and 1 element. The problem exists when I try to put multiple subtasks
    > and elements associated with one task. Is there a way to navigate to a
    > new record and automatically set the value of either the taskID on the
    > Subtasks subform or subtaskID on the Elements subform to link the new
    > subform/element to the initial Task. (i.e. I want to input a task w/
    > TaskID: 111 and a subtask with TaskID: 111 and SubtaskID: 01 and
    > another subtask with TaskID: 111 and SubtaskID: 02; then an element
    > with TaskID: 111 and SubtaskID: 01 and ElementID: 1 and another element
    > with TaskID: 111 and SubtaskID: 01 and ElementID: 2.
    >
    > On the Subtasks subform: Link Child Fields...TaskID and the Link Master
    > Fields...Tasks.TaskID
    >
    > On the Elements subform: Link Child Fields...SubtaskID and the Link
    > Master Fields...Subtasks.SubtaskID
    >
    > Note: not all tasks have multiple subtasks or elements; a task could
    > have 0 subtask but must have an element (element contains due date).


    The way forms and subforms are designed to work is that the main form refers
    to the top level table. In your case, this would be Tasks. The subform
    then refers to the child table (subtasks). A subform on that form would
    then refer to the third level (items). If you establish your relationships
    properly and then create your forms this way, Access will handle the whole
    thing automagically.

    The whole tab thing you want to do is pretty messy from a UI point of view
    and would require a lot of scripting. I'm guessing that you're fairly new
    to Access, and so you may not choose to try to script this. Post back if
    you really DO want to script the whole thing, but I advise you to simply use
    Access the way it was designed.

    HTH;

    Amy
     

Share This Page