PC Review


Reply
Thread Tools Rate Thread

change combo box available selection?

 
 
HotRod
Guest
Posts: n/a
 
      28th Jun 2006
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.


 
Reply With Quote
 
 
 
 
=?Utf-8?B?S0FSTCBERVdFWQ==?=
Guest
Posts: n/a
 
      28th Jun 2006
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.
>
>
>

 
Reply With Quote
 
Wolfgang Kais
Guest
Posts: n/a
 
      28th Jun 2006
"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


 
Reply With Quote
 
HotRod
Guest
Posts: n/a
 
      28th Jun 2006
THANKS I'll have a look


 
Reply With Quote
 
HotRod
Guest
Posts: n/a
 
      29th Jun 2006
Got is working THANKS


"HotRod" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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.
>



 
Reply With Quote
 
MBSNewbie
Guest
Posts: n/a
 
      7th Jul 2006
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" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
>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.
>
>

 
Reply With Quote
 
HotRod
Guest
Posts: n/a
 
      10th Jul 2006
Interesting approach. I'll give it a go THANKS


"MBSNewbie" <(E-Mail Removed)> wrote in message news:%(E-Mail Removed)...
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" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
>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.
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Detect combo box selection change ? =?Utf-8?B?bXNjZXJ0aWZpZWQ=?= Microsoft Access Form Coding 3 9th May 2006 09:07 PM
Using VB to change Combo box selection Richard Clayton Microsoft Excel Programming 0 8th Oct 2004 07:36 PM
Using VB to change Combo box selection Richard Clayton Microsoft Excel Programming 2 8th Oct 2004 03:53 PM
Combo Box selection disappearing on new record and change of option selection EmmA Microsoft Access Forms 2 17th Jun 2004 02:21 AM
Combo box wont change selection? Simon Lloyd Microsoft Excel Programming 3 9th Jun 2004 11:59 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:44 PM.