Welcome to SPN

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

Sign Up Now!

automatically selecting a category with yes/no boxes

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

  1. Lee

    Lee
    Expand Collapse
    Guest

    Hello, I'm new to Access to bare with me.

    I'm trying to create a form where I would have a list of probably 8 yes/no
    questions and if even one of that list is chosen it would automatically check
    yes on larger umbrella category.

    An example:

    INFANT HEALTH
    Immunizations (yes/no box)
    Newborn visit (yes/no box)
    Illness (yes/no box)
    Lead (yes/no box)
    Other (text)

    So if any of the lower case categories were checked it would automatically
    check Infant Health as a the larger umbrella category. There are seven
    umbrella categories with a maximum of 9 lower choices. I can't do a drop down
    menu because I need to be able to check multiple (larger and smaller)
    categories on the same form.

    Thanks so much!

    Lee
     
  2. jmonty

    jmonty
    Expand Collapse
    Guest

    For our example here, your "lower case categories" = Child
    and "Umbrella" = Parent.

    ParentCheckBox
    Child1
    Child2

    Use the Child's Change event to update the Parent check box:
    Select each child checkbox (in design mode) and right-click. Select Build
    Event > Code Builder. Enter code similar to the following:

    Private Sub Child1_Click()
    If Me.Child1 = True then
    Me.ParentCheckBox = True
    Else
    Me.ParentCheckBox = False
    End If
    End Sub

    Private Sub Child2_Click()
    If Me.Child2 = True then
    Me.ParentCheckBox = True
    Else
    Me.ParentCheckBox = False
    End If
    End Sub
     
  3. Lee

    Lee
    Expand Collapse
    Guest

    That's amazingly helpful. Thank you so much.

    Can you tell me what the code would look like if it were a text box instead
    of a check box?

    "jmonty" wrote:

    > For our example here, your "lower case categories" = Child
    > and "Umbrella" = Parent.
    >
    > ParentCheckBox
    > Child1
    > Child2
    >
    > Use the Child's Change event to update the Parent check box:
    > Select each child checkbox (in design mode) and right-click. Select Build
    > Event > Code Builder. Enter code similar to the following:
    >
    > Private Sub Child1_Click()
    > If Me.Child1 = True then
    > Me.ParentCheckBox = True
    > Else
    > Me.ParentCheckBox = False
    > End If
    > End Sub
    >
    > Private Sub Child2_Click()
    > If Me.Child2 = True then
    > Me.ParentCheckBox = True
    > Else
    > Me.ParentCheckBox = False
    > End If
    > End Sub
    > .
    > .
    > etc.
    >
    >
    > Do this for each of the child checkboxes.
    >
    > jmonty
    >
    >
    > "Lee" wrote:
    >
    > > Hello, I'm new to Access to bare with me.
    > >
    > > I'm trying to create a form where I would have a list of probably 8 yes/no
    > > questions and if even one of that list is chosen it would automatically check
    > > yes on larger umbrella category.
    > >
    > > An example:
    > >
    > > INFANT HEALTH
    > > Immunizations (yes/no box)
    > > Newborn visit (yes/no box)
    > > Illness (yes/no box)
    > > Lead (yes/no box)
    > > Other (text)
    > >
    > > So if any of the lower case categories were checked it would automatically
    > > check Infant Health as a the larger umbrella category. There are seven
    > > umbrella categories with a maximum of 9 lower choices. I can't do a drop down
    > > menu because I need to be able to check multiple (larger and smaller)
    > > categories on the same form.
    > >
    > > Thanks so much!
    > >
    > > Lee
     

Share This Page