combo boxes

C

ce

i am kind of new at this. i am trying to synchronize 2
combo boxes on a switchboard. the 1st one i want to list
the categories of my products. the 2nd to show the
products in the category i picked in box 1 then opening a
product information sheet on the product selected in box
2.
is there a way to do this without writing code? that is
not computing in my brain and I am stuck!
 
F

fredg

i am kind of new at this. i am trying to synchronize 2
combo boxes on a switchboard. the 1st one i want to list
the categories of my products. the 2nd to show the
products in the category i picked in box 1 then opening a
product information sheet on the product selected in box
2.
is there a way to do this without writing code? that is
not computing in my brain and I am stuck!

Leave the Row Source property of the 2nd combo box blank.
Code the AfterUpdate event of the first Combo box to fill the 2nd
combo rowsource using a where clause in the SQL.

Here is some generic code.
Add fields to it and change the table name as needed.

The first example assumes the combo1 bound column is a Number
datatype, i.e. a CategoryID field.

[Combo2].RowSource = "Select TableName.Field1, TableName.Field2 from
TableName Where TableName.[FieldName] = " & Combo1 & ";"


If the Combo1 bound column is actually a Text datatype, i.e.
"Desserts", use:

Where TableName.[FieldName] = '" & Combo1 & "';"
 
G

Guest

-----Original Message-----
i am kind of new at this. i am trying to synchronize 2
combo boxes on a switchboard. the 1st one i want to list
the categories of my products. the 2nd to show the
products in the category i picked in box 1 then opening a
product information sheet on the product selected in box
2.
is there a way to do this without writing code? that is
not computing in my brain and I am stuck!

Leave the Row Source property of the 2nd combo box blank.
Code the AfterUpdate event of the first Combo box to fill the 2nd
combo rowsource using a where clause in the SQL.

Here is some generic code.
Add fields to it and change the table name as needed.

The first example assumes the combo1 bound column is a Number
datatype, i.e. a CategoryID field.

[Combo2].RowSource = "Select TableName.Field1, TableName.Field2 from
TableName Where TableName.[FieldName] = " & Combo1 & ";"


If the Combo1 bound column is actually a Text datatype, i.e.
"Desserts", use:

Where TableName.[FieldName] = '" & Combo1 & "';"

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.

Hi Fred and thank you so much for responding to my
message. As i said i am new at this. i have been told
to learn access and build a database from scratch for the
company i work for. yikes! I appologize for not
understanding your previous email code. Could you
explain further? I wasn't sure in the combo 2 code if
this should be table names of the tblcategories or the
tblproducts and fields entered there.
Thank you for your patience.
Connie
 
F

fredg

-----Original Message-----
i am kind of new at this. i am trying to synchronize 2
combo boxes on a switchboard. the 1st one i want to list
the categories of my products. the 2nd to show the
products in the category i picked in box 1 then opening a
product information sheet on the product selected in box
2.
is there a way to do this without writing code? that is
not computing in my brain and I am stuck!

Leave the Row Source property of the 2nd combo box blank.
Code the AfterUpdate event of the first Combo box to fill the 2nd
combo rowsource using a where clause in the SQL.

Here is some generic code.
Add fields to it and change the table name as needed.

The first example assumes the combo1 bound column is a Number
datatype, i.e. a CategoryID field.

[Combo2].RowSource = "Select TableName.Field1, TableName.Field2 from
TableName Where TableName.[FieldName] = " & Combo1 & ";"


If the Combo1 bound column is actually a Text datatype, i.e.
"Desserts", use:

Where TableName.[FieldName] = '" & Combo1 & "';"

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.

Hi Fred and thank you so much for responding to my
message. As i said i am new at this. i have been told
to learn access and build a database from scratch for the
company i work for. yikes! I appologize for not
understanding your previous email code. Could you
explain further? I wasn't sure in the combo 2 code if
this should be table names of the tblcategories or the
tblproducts and fields entered there.
Thank you for your patience.
Connie

Connie,
Perhaps this link will help you.

Forms: Limit content of combo/list boxes
http://www.mvps.org/access/forms/frm0028.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top