Help with Linking Combo boxes in a Subform

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • samdev

    Help with Linking Combo boxes in a Subform

    I have created two combo boxes in a subform....

    For example

    1. Combo Box State
    2. Combo Box City
    3. When a state from the Combo Box State is selected, the City combo
    box updates to reflect the State chosen by only showing cities in that
    selected state.
    4. When I open just the subform it works just fine but when I open the
    Main form the contains the subform there are issues....
    5. I can pick the State just fine but when I go to pick the City - a
    box = an "Enter Parameter Value" opens...request ing the value for
    [forms]![subform]![cbostate]. The city combo box is now blank.

    The row source for the city combo box is a query that contains the
    city and the state field - the criteria for the state field [forms]!
    [subform]![cbostate].

    Not sure why it works, when I do test via the subform but doesn't work
    when when I go the main form that includes the subform....

    Any ideas would be very appreciated.

    Thx!
  • frogsteaks@yahoo.com

    #2
    Re: Help with Linking Combo boxes in a Subform

    On May 28, 12:04 am, samdev <la...@noblesof twaresolutions. comwrote:
    I have created two combo boxes in a subform....
    >
    For example
    >
    1. Combo Box State
    2. Combo Box City
    3. When a state from the Combo Box State is selected, the City combo
    box updates to reflect the State chosen by only showing cities in that
    selected state.
    4. When I open just the subform it works just fine but when I open the
    Main form the contains the subform there are issues....
    5. I can pick the State just fine but when I go to pick the City - a
    box = an "Enter Parameter Value" opens...request ing the value for
    [forms]![subform]![cbostate]. The city combo box is now blank.
    >
    The row source for the city combo box is a query that contains the
    city and the state field - the criteria for the state field [forms]!
    [subform]![cbostate].
    >
    Not sure why it works, when I do test via the subform but doesn't work
    when when I go the main form that includes the subform....
    >
    Any ideas would be very appreciated.
    >
    Thx!
    As usual ther are many ways to skin a cat. A lot depends on how you
    have your data set up. Please describe how the State and the City
    data are maintained.

    Comment

    • Steve

      #3
      Re: Help with Linking Combo boxes in a Subform

      When you open just the subform, the subform is a member of the database
      forms collection so your [forms]![subform]![cbostate] notation correctly
      identifies the subform. When you open the main form, the subform is a member
      of the main form's controls collection so your [forms]![subform]![cbostate]
      notation is not now correct because you are referencing the forms collection
      and not the main form's controls collection. The correct notation is
      [forms]![nameofsubformco ntrolonmainform].form![cbostate]. To get
      "nameofsubformc ontrolonmainfor m" , open the main form in design view, select
      the box that holds the subform, open Properties, go to the Other tab and
      look at the Name property.

      Steve


      "samdev" <laura@noblesof twaresolutions. comwrote in message
      news:bd116f56-c6ae-44c2-99eb-d7e871e5d964@j2 2g2000hsf.googl egroups.com...
      >I have created two combo boxes in a subform....
      >
      For example
      >
      1. Combo Box State
      2. Combo Box City
      3. When a state from the Combo Box State is selected, the City combo
      box updates to reflect the State chosen by only showing cities in that
      selected state.
      4. When I open just the subform it works just fine but when I open the
      Main form the contains the subform there are issues....
      5. I can pick the State just fine but when I go to pick the City - a
      box = an "Enter Parameter Value" opens...request ing the value for
      [forms]![subform]![cbostate]. The city combo box is now blank.
      >
      The row source for the city combo box is a query that contains the
      city and the state field - the criteria for the state field [forms]!
      [subform]![cbostate].
      >
      Not sure why it works, when I do test via the subform but doesn't work
      when when I go the main form that includes the subform....
      >
      Any ideas would be very appreciated.
      >
      Thx!

      Comment

      • samdev

        #4
        Re: Help with Linking Combo boxes in a Subform

        On May 28, 2:15 pm, "Steve" <no...@email.co mwrote:
        When you open just the subform, the subform is a member of the database
        forms collection so your  [forms]![subform]![cbostate] notation correctly
        identifies the subform. When you open the main form, the subform is a member
        of the main form's controls collection so your [forms]![subform]![cbostate]
        notation is not now correct because you are referencing the forms collection
        and not the main form's controls collection. The correct notation is
        [forms]![nameofsubformco ntrolonmainform].form![cbostate]. To get
        "nameofsubformc ontrolonmainfor m" , open the main form in design view, select
        the box that holds the subform, open Properties, go to the Other tab and
        look at the Name property.
        >
        Steve
        >
        "samdev" <la...@noblesof twaresolutions. comwrote in message
        >
        news:bd116f56-c6ae-44c2-99eb-d7e871e5d964@j2 2g2000hsf.googl egroups.com...
        >
        >
        >
        I have created two combo boxes in a subform....
        >
        For example
        >
        1. Combo Box State
        2. Combo Box City
        3. When a state from the Combo Box State is selected, the City combo
        box updates to reflect the State chosen by only showing cities in that
        selected state.
        4. When I open just the subform it works just fine but when I open the
        Main form the contains the subform there are issues....
        5. I can pick the State just fine but when I go to pick the City - a
        box = an "Enter Parameter Value" opens...request ing the value for
        [forms]![subform]![cbostate]. The city combo box is now blank.
        >
        The row source for the city combo box is a query that contains the
        city and the state field - the criteria for the state field [forms]!
        [subform]![cbostate].
        >
        Not sure why it works, when I do test via the subform but doesn't work
        when when I go the main form that includes the subform....
        >
        Any ideas would be very appreciated.
        >
        Thx!- Hide quoted text -
        >
        - Show quoted text -
        Steve:
        Thx - I have tried that it still doesn't work and it should from what
        you have explained....I even changed the name of the subform in the
        mainform and then went and updated the query and I'm still getting the
        same parameter value box. I checked to make sure that I was clicking
        on the subform box in the mainform by checking the title of the
        property box and it reads Subform/subreport so still not sure what is
        wrong.

        Any other ideas.

        Thx!

        Comment

        • Steve

          #5
          Re: Help with Linking Combo boxes in a Subform

          I reread my reply to you and I made an error. Sorry!!

          [forms]![nameofsubformco ntrolonmainform].form![cbostate]

          Should Be:

          [forms]!{NameOfMainFor m]![nameofsubformco ntrolonmainform].form![cbostate]

          Also, the white box on your main form is a subform control. The name of that
          control is what you want for [nameofsubformco ntrolonmainform] NOT the name
          of your subform. The name of the subform control may or may not be the same
          as the name of the subform.

          Steve



          "samdev" <laura@noblesof twaresolutions. comwrote in message
          news:5adba9fa-a6e8-45c1-9a65-86f921d1049a@s5 0g2000hsb.googl egroups.com...
          On May 28, 2:15 pm, "Steve" <no...@email.co mwrote:
          When you open just the subform, the subform is a member of the database
          forms collection so your [forms]![subform]![cbostate] notation correctly
          identifies the subform. When you open the main form, the subform is a
          member
          of the main form's controls collection so your
          [forms]![subform]![cbostate]
          notation is not now correct because you are referencing the forms
          collection
          and not the main form's controls collection. The correct notation is
          [forms]![nameofsubformco ntrolonmainform].form![cbostate]. To get
          "nameofsubformc ontrolonmainfor m" , open the main form in design view,
          select
          the box that holds the subform, open Properties, go to the Other tab and
          look at the Name property.
          >
          Steve
          >
          "samdev" <la...@noblesof twaresolutions. comwrote in message
          >
          news:bd116f56-c6ae-44c2-99eb-d7e871e5d964@j2 2g2000hsf.googl egroups.com...
          >
          >
          >
          I have created two combo boxes in a subform....
          >
          For example
          >
          1. Combo Box State
          2. Combo Box City
          3. When a state from the Combo Box State is selected, the City combo
          box updates to reflect the State chosen by only showing cities in that
          selected state.
          4. When I open just the subform it works just fine but when I open the
          Main form the contains the subform there are issues....
          5. I can pick the State just fine but when I go to pick the City - a
          box = an "Enter Parameter Value" opens...request ing the value for
          [forms]![subform]![cbostate]. The city combo box is now blank.
          >
          The row source for the city combo box is a query that contains the
          city and the state field - the criteria for the state field [forms]!
          [subform]![cbostate].
          >
          Not sure why it works, when I do test via the subform but doesn't work
          when when I go the main form that includes the subform....
          >
          Any ideas would be very appreciated.
          >
          Thx!- Hide quoted text -
          >
          - Show quoted text -
          Steve:
          Thx - I have tried that it still doesn't work and it should from what
          you have explained....I even changed the name of the subform in the
          mainform and then went and updated the query and I'm still getting the
          same parameter value box. I checked to make sure that I was clicking
          on the subform box in the mainform by checking the title of the
          property box and it reads Subform/subreport so still not sure what is
          wrong.

          Any other ideas.

          Thx!


          Comment

          • samdev

            #6
            Re: Help with Linking Combo boxes in a Subform

            On May 28, 6:49 pm, "Steve" <no...@email.co mwrote:
            I reread my reply to you and I made an error. Sorry!!
            >
             [forms]![nameofsubformco ntrolonmainform].form![cbostate]
            >
            Should Be:
            >
             [forms]!{NameOfMainFor m]![nameofsubformco ntrolonmainform].form![cbostate]
            >
            Also, the white box on your main form is a subform control. The name of that
            control is what you want for [nameofsubformco ntrolonmainform] NOT the name
            of your subform. The name of the subform control may or may not be the same
            as the name of the subform.
            >
            Steve
            >
            "samdev" <la...@noblesof twaresolutions. comwrote in message
            >
            news:5adba9fa-a6e8-45c1-9a65-86f921d1049a@s5 0g2000hsb.googl egroups.com...
            On May 28, 2:15 pm, "Steve" <no...@email.co mwrote:
            >
            >
            >
            >
            >
            When you open just the subform, the subform is a member of the database
            forms collection so your [forms]![subform]![cbostate] notation correctly
            identifies the subform. When you open the main form, the subform is a
            member
            of the main form's controls collection so your
            [forms]![subform]![cbostate]
            notation is not now correct because you are referencing the forms
            collection
            and not the main form's controls collection. The correct notation is
            [forms]![nameofsubformco ntrolonmainform].form![cbostate]. To get
            "nameofsubformc ontrolonmainfor m" , open the main form in design view,
            select
            the box that holds the subform, open Properties, go to the Other tab and
            look at the Name property.
            >
            Steve
            >
            "samdev" <la...@noblesof twaresolutions. comwrote in message
            >
            news:bd116f56-c6ae-44c2-99eb-d7e871e5d964@j2 2g2000hsf.googl egroups.com...
            >
            >I have created two combo boxes in a subform....
            >
            For example
            >
            1. Combo Box State
            2. Combo Box City
            3. When a state from the Combo Box State is selected, the City combo
            box updates to reflect the State chosen by only showing cities in that
            selected state.
            4. When I open just the subform it works just fine but when I open the
            Main form the contains the subform there are issues....
            5. I can pick the State just fine but when I go to pick the City - a
            box = an "Enter Parameter Value" opens...request ing the value for
            [forms]![subform]![cbostate]. The city combo box is now blank.
            >
            The row source for the city combo box is a query that contains the
            city and the state field - the criteria for the state field [forms]!
            [subform]![cbostate].
            >
            Not sure why it works, when I do test via the subform but doesn't work
            when when I go the main form that includes the subform....
            >
            Any ideas would be very appreciated.
            >
            Thx!- Hide quoted text -
            >
            - Show quoted text -
            >
            Steve:
            Thx - I have tried that it still doesn't work and it should from what
            you have explained....I even changed the name of the subform in the
            mainform and then went and updated the query and I'm still getting the
            same parameter value box. I checked to make sure that I was clicking
            on the subform box in the mainform by checking the title of the
            property box and it reads Subform/subreport so still not sure what is
            wrong.
            >
            Any other ideas.
            >
            Thx!- Hide quoted text -
            >
            - Show quoted text -
            It worked - THANK YOU! THANK YOU!

            Comment

            Working...