populating a second combo box depending on criteria of the first combo box

K

King Kaos

Can someone help me, I've looked at several samples of this type cbo on a
form but I can not get this to work. I have a table called Type - which has
the fields of TypeGen and TypeSpe (these stand for Type-general and
Type-Specific). In this table I have several books names and books type
(for example I have TypeGen "Sci-Fi" and TypeSpe "2001 a space odyssey"). I
want to set up my form so when I select Sci-Fi from TypeGen I get a list of
the Sci-Fi books in the second combo field. I created a query (QType) with
the control source related to the "TypeGen" field in my form. I then Set
TypeSpe RowSource to be related to this query. I did a requery command in
the AfterEvent on the TypeGen field. But this still doesn't work for me.
It always goes back to the first record in the table and only use the
TypeGen field from the first record. - does this make sense. Can anyone
help me with this



Thanks



Keith
 
D

Dirk Goldgar

King Kaos said:
Can someone help me, I've looked at several samples of this type cbo
on a form but I can not get this to work. I have a table called Type
- which has the fields of TypeGen and TypeSpe (these stand for
Type-general and Type-Specific). In this table I have several books
names and books type (for example I have TypeGen "Sci-Fi" and TypeSpe
"2001 a space odyssey"). I want to set up my form so when I select
Sci-Fi from TypeGen I get a list of the Sci-Fi books in the second
combo field. I created a query (QType) with the control source
related to the "TypeGen" field in my form. I then Set TypeSpe
RowSource to be related to this query. I did a requery command in
the AfterEvent on the TypeGen field. But this still doesn't work for
me. It always goes back to the first record in the table and only use
the TypeGen field from the first record. - does this make sense.
Can anyone help me with this

It sounds like you're requerying the form, not the second combo box.
I'm not sure from what you wrote what the name of that combo box is, but
in the AfterUpdate event of the first combo box you should execute a
statement like this (instead of what you're doing):

Me.YourSecondCombo.Requery

(replacing "YourSecondCombo" in the above statement with the name of the
combo box to be requeried).
 

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