There may be other way to do it, but this is how I would do it.
******REMEMBER that this is an example...you will need to change some
field names and table names to make it work with your
enviroment.************
First Create your two tables with the appropriate fields:
-Categories (TABLE)
--CatID (FIELD)
--CategoryName (FIELD)
-SubCategories (TABLE)
--SubCatID (FIELD)
--SubCategoryName (FIELD)
--CatID (FIELD)
Categoiries.CatID Needs to have a relationship with
SubCategories.CatID
As you fill in the subCategories a CatID needs to be populated as
well.
Now for the FORM and 4 "Unbound" Fields:
-Cat_SubCat FORM
--Cat 'Should be a Combo Box
--CatID 'Should be a Text Box
--SubCat 'Should be a Combo Box
--SubCatID 'Should be a Text Box
Now for the field properites:
--Cat (Combo Box)
Under Properties/Data tab:
RowSource Type: Table/Query (default)
Row Source: SELECT Category.CatID, Category.Category FROM Category;
Under Properties/Event Tab:
After Update: [Event Procedure] Click on the [...] button at the
end of the row:
Private Sub Cat_AfterUpdate()
Me.CatID = Me.Cat.Column(0)
Me.SubCat.Requery
Me.SubCatID = Null
End Sub
--SubCat (Combo Box)
Under Properties/Data tab:
RowSource Type: Table/Query (default)
Row Source: SELECT SubCategory.SubCatID,
SubCategory.SubCategory,SubCategory.CatID FROM SubCategory WHERE
(((SubCategory.CatID)=Forms!Cat_SubCat!CatID));
Under Properties/Event Tab:
After Update: [Event Procedure] Click on the [...] button at the
end of the row:
Private Sub CatSub_AfterUpdate()
Me.SubCatID = Me.SubCat.Column(0)
End Sub
That should get you what you want. Study it and learn how everything
links and works to nake it a learning experience. I hope it helps!
On Apr 30, 7:31 pm, JA <jarmour at kc.rr.comwrote:
Scott, I do need them to show. I have the categories in, looking up a
value list, with them in like so:
balls;bats;cats;dogs
The next field, I had it lookup a query. It gives me a dropdown of the
catids, but they aren't connected to the categories.
What I want to happen, is if I choose balls in the category field, a "1"
will show up in the catid field, and if I choose bats, a "2" will show
up, and so on.
But I don't really know what I'm doing. So any help is appreciated!
*** Sent via Developersdexhttp://www.developersdex.com***