Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / April 2008

Tip: Looking for answers? Try searching our database.

Filter Dropdown Combobox by Another Field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kdagostino - 11 Apr 2008 14:42 GMT
I have a subform for tblFaculty in which the fields Title, FirstName,
LastName, and Suffix are combo boxes based on those fields.  i.e. Title looks
up the values in Title from tblFaculty.

Is there a way I can filter the dropdown menus based on which one has been
entered?  

For example, if the user enters in data in LastName, then FirstName only
looks up values for FirstName which have that last name as well.  

I
Klatuu - 11 Apr 2008 15:25 GMT
Yes, the technique is called Cascading Combos.
To do this, you use queries for your combo row source properties.
You make the second combo in the order you want filter based on the value in
the first combo, and the third filter on the second, etc.
Then in the After Update event of the first combo, requery the second combo,
and in the After Update event of the second combo, requery the third, and so
on.

Signature

Dave Hargis, Microsoft Access MVP

> I have a subform for tblFaculty in which the fields Title, FirstName,
> LastName, and Suffix are combo boxes based on those fields.  i.e. Title looks
[quoted text clipped - 7 lines]
>
> I
thefonz37 - 11 Apr 2008 17:15 GMT
Is there a website that maybe gives a simple tutorial for the steps on how to
do this?  Maybe an example database?

> Yes, the technique is called Cascading Combos.
> To do this, you use queries for your combo row source properties.
[quoted text clipped - 15 lines]
> >
> > I
Klatuu - 11 Apr 2008 17:44 GMT
Thought I knew where one is, but I can't find it.
Actually, it is not that hard.
Lets say we want to filter by Company and Department.
Lets set up two combos.  cboComp and cboDept
We only want to see departments in cboDept for the company selected in
cboComp.

So we set up our row source for cboComp
  SELECT CompID, CompName FROM tblCompany;

Where The bound column is 1, which will return CompID for the selected row.

Now we set up the row source for cboDept to filter on the company
   SELECT DeptID, DeptName FROM tblDept WHERE CompDept = Me.cboComp;

Where CompDept is the field in tblDept that is the foreign key to tblCompany

Now in the After Update event of cboComp

   Me.cboDept.Requery

Simple as that.  When you select a company, only that company's departments
will be listed in cboDept.

So, one step further, we only want to see Contacts in the Department
selected.  We need a row source for cboContact that filters on the selected
department

   SELECT ContactID, ContactName FROM tblContact WHERE DeptContact =
Me.cboDept;

And again, in the After Update of cboDept

   Me.cboContact.Requery
Signature

Dave Hargis, Microsoft Access MVP

> Is there a website that maybe gives a simple tutorial for the steps on how to
> do this?  Maybe an example database?
[quoted text clipped - 18 lines]
> > >
> > > I
Douglas J. Steele - 11 Apr 2008 18:09 GMT
Is
http://office.microsoft.com/en-us/access/HA011730581033.aspx?pid=CH063650361033
what you were looking for?

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Thought I knew where one is, but I can't find it.
>
>> Is there a website that maybe gives a simple tutorial for the steps on
>> how to
>> do this?  Maybe an example database?
Clif McIrvin - 11 Apr 2008 23:47 GMT
Well Doug, I can't speak for anyone else, but that link sure looks
like something I will be able to use in the app I'm developing!

Thanks.

--
Clif

On Apr 11, 12:09 pm, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
> Ishttp://office.microsoft.com/en-us/access/HA011730581033.aspx?pid=CH06...
> what you were looking for?
>
> --
> Doug Steele, Microsoft Access MVPhttp://I.Am/DougSteele
> (no e-mails, please!)
thefonz37 - 11 Apr 2008 18:11 GMT
Hmm...on futher though this might not be the right thing I need to use.  
Thanks for answer, though, I'm definitely storing the knowledge for future
use.

> Thought I knew where one is, but I can't find it.
> Actually, it is not that hard.
[quoted text clipped - 53 lines]
> > > >
> > > > I
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.