Base drop down list on another control value

  • Thread starter Thread starter KLR
  • Start date Start date
K

KLR

I have searched within the the newsgroup for help on the above but
can't seem to fin what I am looking for.

I have 2 tables:-

Analysis Code which can be A, I or C
And Categories which can be Leave (comes under A), Sick (A), Client
(C), Officer (I).

I need to base the Categorie dropdown on the value of Code i.e. if
code=A, then the category dropdown will only display values associated
with A.

If code=C etc.

I'm not sure how to do this, and also whether I need 2 separate tables
to begin with.

Help!

KLR
 
KLR,
Sounds like you shouldn't need two tables.

How many Codes and Categories do you have?
That would make a difference as to how you set this up.
Using 2 combos for say 10 or so categories might be a bit of overkill.

One table should do it...
tblCategories
Code Category
A Leave
A Sick
C Client
I Officer etc...

Let's use cboCode vs cboCategory. Both cbos would use a query against tblCategories as
their row source.
Use the Code value selected in cboCode to filter the results of cboCategory.
In the cboCategory query, include the Code field (don't display it though), and use
this criteria against Code...
=Forms!frmYourFormName!cboCode
Whenever you select a value in cboCode, use the AfterUpdate event to Requery
cboCategories, so they always stay in synch.

On my web site (below) I have a sample A97 or A2003 file called Synched Combos, which
demonstrates this method.

--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
There are 10 types of people in the world.
Those who understand binary, and those who don't.
 
Back
Top