By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,047 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Automatically fill fields.

P: n/a
JA
Not exactly sure how to explain this. I have 4 fields (in access 2000).

Category, Catid, Subcat, subcatid.
There are 40 categories, and about 1500 subcats. I've added the categories
to the lookup, so when I enter them in the field, I can usually just type
the first letter or two. (they are in a dropdown box).

I would like to have the CatID show up automatically in it's field, after I
type in the category.

And then, have the Subcats show in a dropdown box, but only the ones that go
to the category in the first field.

AND, after I pick the subcat, have it's ID number show up in the 4th field.

So if I picked Balls, categoryID 2 would show up in the next field, and then
a dropdown with Baseball,Basketball,Football would show in the 3rd field,
and when I picked Basketball, 132 would show up in the 4th field.

Hope that makes sense. Is that possible? How would I go about it?

Thanks! J~
May 1 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Do you need the catid and subcatid to show?

If you do you should eliminate then from your table and just have category
and subcat. The you could do a look up on your form to reference the ids
from yout category and sub category tables.
"JA" <jarmour at kc.rr.comwrote in message
news:46**********************@roadrunner.com...
Not exactly sure how to explain this. I have 4 fields (in access 2000).

Category, Catid, Subcat, subcatid.
There are 40 categories, and about 1500 subcats. I've added the categories
to the lookup, so when I enter them in the field, I can usually just type
the first letter or two. (they are in a dropdown box).

I would like to have the CatID show up automatically in it's field, after
I type in the category.

And then, have the Subcats show in a dropdown box, but only the ones that
go to the category in the first field.

AND, after I pick the subcat, have it's ID number show up in the 4th
field.

So if I picked Balls, categoryID 2 would show up in the next field, and
then a dropdown with Baseball,Basketball,Football would show in the 3rd
field, and when I picked Basketball, 132 would show up in the 4th field.

Hope that makes sense. Is that possible? How would I go about it?

Thanks! J~

May 1 '07 #2

P: n/a
JA


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 Developersdex http://www.developersdex.com ***
May 1 '07 #3

P: n/a
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***

May 2 '07 #4

P: n/a
JA
Thanks Anonymous, but this seems to be for a form. I want it to be in
the table itself. Is that possible?

*** Sent via Developersdex http://www.developersdex.com ***
May 5 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.