dbTalk Databases Forums  

Fill combo/list box based on previous combo box selection?

comp.database.ms-access comp.database.ms-access


Discuss Fill combo/list box based on previous combo box selection? in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
nick
 
Posts: n/a

Default Fill combo/list box based on previous combo box selection? - 08-19-2004 , 04:21 PM






I am fairly new to database design and am having some difficulty
getting my combo boxes to work as I'd like them to. I would like to
create a form with two combo boxes; the first one would select
‘JobNum' from my master job table and the second would select a ‘Supt'
associated with the selected JobNum.

My tables are setup like this:
-tblEmp: Emp# (PRIMARY KEY), EmpName, etc.
-tblSupt: SuptEmp#, Job#
-tblInjury: InjuredEmp#, Job#, Supt#, etc.
-tblJob: Job# (PRIMARY KEY), JobName, etc.

How can I setup my two combo boxes so that:

Combo Box 1 selects Job# from the list of Job#'s? I can get this far,
but a can't seem to tackle the AfterUpdate event in order to
successfully populate the 2nd combo box.

And Combo Box 2 selects an associated Supt#, a list populated from the
selection in Combo Box 1?

Thanks in advance for any assistance.

Nick

Reply With Quote
  #2  
Old   
Wes
 
Posts: n/a

Default Re: Fill combo/list box based on previous combo box selection? - 08-20-2004 , 08:35 AM






Nick,

If I understand you right, you want to select a Job# and have the
second combo box update to show Supt#'s for the selected Job#. This is
what I would do.

This is done using a form. Since you have the Job# combo box working
let's look at the Supt# combo. Create the Supt# combo like normal.
Then go to the properties of the Supt# combo and go to the data tab.
Then goto row source and click the build button. From here you can add
the Job# field from your tblSupt to the design grid and set the
criteria to the Job# combo box on your form. This will tell the combo
box what to display. But to make it work like you want you have to go
to the after update property of the Job# combo box and click Code
builder. Here you will type in Me.Combo2.requery. (Combo2 is the name
of the Supt# combo box) This will requery your box every time you
change something in the Job# combo box.

If your confused let me know and I can e-mail you an example.

Good luck,
Wes

nfemal (AT) findorff (DOT) com (nick) wrote in message news:<d7b63544.0408191321.761dccd8 (AT) posting (DOT) google.com>...
Quote:
I am fairly new to database design and am having some difficulty
getting my combo boxes to work as I'd like them to. I would like to
create a form with two combo boxes; the first one would select
?JobNum' from my master job table and the second would select a ?Supt'
associated with the selected JobNum.

My tables are setup like this:
-tblEmp: Emp# (PRIMARY KEY), EmpName, etc.
-tblSupt: SuptEmp#, Job#
-tblInjury: InjuredEmp#, Job#, Supt#, etc.
-tblJob: Job# (PRIMARY KEY), JobName, etc.

How can I setup my two combo boxes so that:

Combo Box 1 selects Job# from the list of Job#'s? I can get this far,
but a can't seem to tackle the AfterUpdate event in order to
successfully populate the 2nd combo box.

And Combo Box 2 selects an associated Supt#, a list populated from the
selection in Combo Box 1?

Thanks in advance for any assistance.

Nick

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.