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

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.
    >
    >
     
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