Group:  Microsoft Access ยป microsoft.public.access.modulescoding
Thread: combo box

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

combo box
"tiger" <aaa0715[ at ]omega.uta.edu> 04.03.2006 06:29:24
Hi,

I have two combo box on a form and I was trying to use the top combo box to
determine the content of the 2nd combo box. i.e if the top combo box content
is Car and Truck. If the user select Car, then the content of the second
combo box will be list of Cars type in table and if the user selects Truck
the content of the second combo box will be Truck in table.

My question is if I change the choice of the 1st ComboBox for the second
time or several times, how can I get the 2nd ComboBox to reflect this
changes?

I have a table like this below...

tblAuto:
Automobile Type
C240 Car
LS430 Car
F150 Truck
Ram Truck
Tundra Truck
GeoPrizm Car
Audi A6 Car

and I have two ComboBox on a Form name: - cbxCombo1, cbxCombo2

In cbxCombo1 I have the following...

Code:-
Private Sub cbxCombo1_Afterupdate
Me!cbxCombo2.Requery
End Sub

Property:-
RowSourceType = Table/Query
RowSource = Category

Category is a Query see below...
SELECT DISTINCT tblAuto.Type FROM tblAuto;

For cbxCombo2 I have the following...
Property:-
RowSourceType - Table/Query
RowSource - Query1

Query1 is....
SELECT tblAuto.Automobile FROM tblAuto WHERE tblAuto.Type =
Forms!Form3!cbxCombo1;

Thanks
Tiger


Re: combo box
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> 04.03.2006 12:34:44
That's exactly what your code is supposed to do. Isn't it working?

Check to make sure that the AfterUpdate event is actually firing for
cbxCombo1. Sometimes events get disconnected from their controls. Look at
the Properties for the combo box: does it say [Event Procedure] beside the
AfterUpdate event?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"tiger" <aaa0715[ at ]omega.uta.edu> wrote in message
news:egTovR1PGHA.5400[ at ]TK2MSFTNGP09.phx.gbl...
[Quoted Text]
> Hi,
>
> I have two combo box on a form and I was trying to use the top combo box
> to determine the content of the 2nd combo box. i.e if the top combo box
> content is Car and Truck. If the user select Car, then the content of the
> second combo box will be list of Cars type in table and if the user
> selects Truck the content of the second combo box will be Truck in table.
>
> My question is if I change the choice of the 1st ComboBox for the second
> time or several times, how can I get the 2nd ComboBox to reflect this
> changes?
>
> I have a table like this below...
>
> tblAuto:
> Automobile Type
> C240 Car
> LS430 Car
> F150 Truck
> Ram Truck
> Tundra Truck
> GeoPrizm Car
> Audi A6 Car
>
> and I have two ComboBox on a Form name: - cbxCombo1, cbxCombo2
>
> In cbxCombo1 I have the following...
>
> Code:-
> Private Sub cbxCombo1_Afterupdate
> Me!cbxCombo2.Requery
> End Sub
>
> Property:-
> RowSourceType = Table/Query
> RowSource = Category
>
> Category is a Query see below...
> SELECT DISTINCT tblAuto.Type FROM tblAuto;
>
> For cbxCombo2 I have the following...
> Property:-
> RowSourceType - Table/Query
> RowSource - Query1
>
> Query1 is....
> SELECT tblAuto.Automobile FROM tblAuto WHERE tblAuto.Type =
> Forms!Form3!cbxCombo1;
>
> Thanks
> Tiger
>
>


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net