Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Category and Subcategory (combobox)

Status
Not open for further replies.

jbpelletier

Programmer
Sep 8, 2001
232
0
0
CA

Ok, well i have something like this...
3 tables

Category SubCategory Item
------------- ------------- -------------
*Cat_ID 1\ *SubCat_ID 1\ *index
CatName \+ Cat_ID \+ SubCat_ID
SubCatName OTHERFIELDS

Im trying to make a form with 2 combobox, (category, SubCategory) and some other field from the "item" table.

My problem is, that i whant that the subCategory combobox's list only show item that have the Cat_id selected in the category combobox, and, i whant that the category represent the Cat_id in the subcaterory when the user move from record... How can i do this?

Usualy in other language as in delphi u have to set a Filter on subcattegory and in subcattegory set an event "on change" to update the category field.. but so far its not
working using access?!

tanx jb
 
Just off the top of my head, I'd set up a query for the sub category and use the form combo box field as the criteria.
 
One way is to change the rowSource of the Subcategory. You can do it on OnChange function of the Category.

It's something like :

Private sub Categorie_change()
Me.SubCategory.Rowsource = "SELECT * FROM SubCategorie WHERE Cat_ID = " & Me.Categorie.Value
End sub

Of course the bound column of the category control must be Cat_ID.

 
>zrzr

this do only half of the job! i had already tried it before i write this post

>half of the job because:

1)
- i pick a cat -> this refresh the subcat combo perfecly
- i pick a sub cat (everything still ok)
- i pick a new cat.. this refresh the subcat combox box
but leave the old subcat value in the combobox
(oupss!)

2)
- i move to an other record
- the cat doesn't refresh to the correct subcat of the
new shown record!

it "supposed" to be an easy thing to do since acces is made to build database form, what im try do to is a classic in database programation and this is codable only by "clicking" (withoout having to write code) in almost all other language even if theyn't specificly made to build database appz (even in c++!)

any other suggestion?

jb
 
I think you need to add a requery or refresh to the click subroutine of the catagory combo box
 
tried it also;(
the combobox's list is correcly update..
only the combobox's "textbox" is'nt.. it keep the old value.. often the value shown in the "textbox" isn't in the comboxlist.
jb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top