Welcome to SPN

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

Sign Up Now!

change combo box available selection?

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

  1. HotRod

    HotRod
    Expand Collapse
    Guest

    I have two combo boxes on a form that are both linked to the same table
    "location" that contains on column 1 all of the main locations and in column
    2 all of the sub locations for each main location. I want the user to select
    the Main Location from combo 1 and then only be shown the sub locations in
    combo 2 that match the Main Location in combo 1.
     
  2. Loading...


  3. KARL DEWEY

    KARL DEWEY
    Expand Collapse
    Guest

    Search on Cascading Combo boxes.

    "HotRod" wrote:

    > I have two combo boxes on a form that are both linked to the same table
    > "location" that contains on column 1 all of the main locations and in column
    > 2 all of the sub locations for each main location. I want the user to select
    > the Main Location from combo 1 and then only be shown the sub locations in
    > combo 2 that match the Main Location in combo 1.
    >
    >
    >
     
  4. HotRod

    HotRod
    Expand Collapse
    Guest

    THANKS I'll have a look
     
  5. Wolfgang Kais

    Wolfgang Kais
    Expand Collapse
    Guest

    "HotRod" wrote:
    > I have two combo boxes on a form that are both linked to the same
    > table "location" that contains on column 1 all of the main locations and
    > in column 2 all of the sub locations for each main location. I want the
    > user to select the Main Location from combo 1 and then only be
    > shown the sub locations in combo 2 that match the Main Location
    > in combo 1.


    Create 2 queries.
    Query 1 selects all main locations (you might have to use the unique
    values property to show each main loaction only once). Use this
    query for combo 1.
    Query 2 selects all sub locations were the main location is the one
    displayed in combo 1. You can use the epression builder to point
    to combo 1 on the form. Use query 2 for combo 2.
    Then, create an event procedure for the AfterUpdate event of
    combo 1 that executes
    combo2.Requery

    --
    Regards,
    Wolfgang
     
  6. HotRod

    HotRod
    Expand Collapse
    Guest

    Got is working THANKS


    "HotRod" <NOSPAM@youremail.com> wrote in message
    news:uhQV7FumGHA.4076@TK2MSFTNGP03.phx.gbl...
    >I have two combo boxes on a form that are both linked to the same table
    >"location" that contains on column 1 all of the main locations and in
    >column 2 all of the sub locations for each main location. I want the user
    >to select the Main Location from combo 1 and then only be shown the sub
    >locations in combo 2 that match the Main Location in combo 1.
    >
     
  7. MBSNewbie

    MBSNewbie
    Expand Collapse
    Guest

    I just learned something!
    OK, here goes Create your two combo Boxes
    In the properties window try this:

    Row/Source Type = Table/Query

    Row Source for Combo1:
    SELECT DISTINCT Location.Main FROM Location ORDER BY [Main];

    Row Source for Combo2:
    SELECT DISTINCT Location.Sub, FROM Location WHERE (((Location.Main)=[Forms]![Form1]![Combo1]));

    Location = Change to Table Name where the info resides.
    Main - Change to Field Name for Main
    Sub - Change to Field Name for Sub
    Form1 - Change to Name of Current Form
    Combo1 - Change to Name of first combo box

    Hope it works, give it a go!
    Tammie

    "HotRod" <NOSPAM@youremail.com> wrote in message news:uhQV7FumGHA.4076@TK2MSFTNGP03.phx.gbl...
    >I have two combo boxes on a form that are both linked to the same table
    > "location" that contains on column 1 all of the main locations and in column
    > 2 all of the sub locations for each main location. I want the user to select
    > the Main Location from combo 1 and then only be shown the sub locations in
    > combo 2 that match the Main Location in combo 1.
    >
    >
     
  8. HotRod

    HotRod
    Expand Collapse
    Guest

    Interesting approach. I'll give it a go THANKS


    "MBSNewbie" <tamking2@hotmail.com> wrote in message news:%23gpwfzgoGHA.3812@TK2MSFTNGP03.phx.gbl...
    I just learned something!
    OK, here goes Create your two combo Boxes
    In the properties window try this:

    Row/Source Type = Table/Query

    Row Source for Combo1:
    SELECT DISTINCT Location.Main FROM Location ORDER BY [Main];

    Row Source for Combo2:
    SELECT DISTINCT Location.Sub, FROM Location WHERE (((Location.Main)=[Forms]![Form1]![Combo1]));

    Location = Change to Table Name where the info resides.
    Main - Change to Field Name for Main
    Sub - Change to Field Name for Sub
    Form1 - Change to Name of Current Form
    Combo1 - Change to Name of first combo box

    Hope it works, give it a go!
    Tammie

    "HotRod" <NOSPAM@youremail.com> wrote in message news:uhQV7FumGHA.4076@TK2MSFTNGP03.phx.gbl...
    >I have two combo boxes on a form that are both linked to the same table
    > "location" that contains on column 1 all of the main locations and in column
    > 2 all of the sub locations for each main location. I want the user to select
    > the Main Location from combo 1 and then only be shown the sub locations in
    > combo 2 that match the Main Location in combo 1.
    >
    >
     

Share This Page