Group:  Microsoft Access ยป microsoft.public.access.modulescoding
Thread: ComboBox Question...

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

ComboBox Question...
"tiger" <aaa0715[ at ]omega.uta.edu> 03.03.2006 05:47:53
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.

But the problem is that using the data/table/query/comboBoxes I provided
below, When I run it I am getting a small window Title "Enter Parameter
Value -Forms!FormName!cbxCombo1", I will like to get rid of this, and just
let the second comboBox be populated with entering a value into the window.

2nd Question - If I change the choice of the 1st ComboBox, how can I get the
2nd ComboBox to reflect this.?

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!FormName!cbxCombo1;

Thanks
Tiger


Re: ComboBox Question...
"Tom Lake" <tlake[ at ]twcny.rr.com> 03.03.2006 06:34:54
[Quoted Text]
> But the problem is that using the data/table/query/comboBoxes I provided
> below, When I run it I am getting a small window Title "Enter Parameter
> Value -Forms!FormName!cbxCombo1", I will like to get rid of this, and just
> let the second comboBox be populated with entering a value into the
> window.

I believe you have to specify which column from the first combo box you
want:

SELECT tblAuto.Automobile FROM tblAuto WHERE tblAuto.Type =
Forms!FormName!cbxCombo1.Column(0);

Tom Lake


Re: ComboBox Question...
Mattias Jonsson <news[ at ]ett-remove-idesystem.se> 03.03.2006 12:24:35
If your form is actually named Form Name (with a space in the name) then
your query 1 should be something like this:

SELECT tblAuto.Automobile FROM tblAuto WHERE tblAuto.Type =
Forms![Form Name]!cbxCombo1;

If your form is named something else, then replace FormName with the
actual form name.

Good luck -
Mattias

From: tiger, on 3/3/2006 12:47 AM:
[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.
>
> But the problem is that using the data/table/query/comboBoxes I provided
> below, When I run it I am getting a small window Title "Enter Parameter
> Value -Forms!FormName!cbxCombo1", I will like to get rid of this, and just
> let the second comboBox be populated with entering a value into the window.
>
> 2nd Question - If I change the choice of the 1st ComboBox, how can I get the
> 2nd ComboBox to reflect this.?
>
> 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!FormName!cbxCombo1;
>
> Thanks
> Tiger

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