populating a second combo box depending on the first combo box

  • Thread starter Thread starter King Kaos
  • Start date Start date
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
 
Create a query named QryTypeGen based on your table and only include the
field TypeGen. Set Sort ascending. For the first Cbo, make this query the
rowsource. Set the Bound Column 1, Column Count 1 and Column Width 1.5. Name
the Cbo CboTypeGen. Create a second query named QryTypeSpe based on your
table and include TypeSpe in the first field and TypeGen in the second
field. Set the criteria for TypeGen as:
Forms!NameOfYourForm!CboTypeGen. For the second Cbo, make this query the
rowsource. Set the Bound Column 1, Column Count 1 and Column Width 2.5. Name
the Cbo CboTypeSpe. Enter the folowing code in the AfterUpdate event of
CboTypeGen:
Me!CboTypeSpe.Requery
Me!CboTypeSpe.SetFocus
Me!CboTypeSpe.DropDown
 
you are a god - I have been working on this for several days to have this
form complete a simple task

thank you

Keith
 
Back
Top