Welcome to SPN

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

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

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
    Why Are So Many, More And More Sikh Women Dating/marrying Hindu Men? Love & Marriage Mar 29, 2017
    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

  3. OP
    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. OP
    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
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page