Make second combo box display items based on what is chosen in a f

M

MackBlale

I have created a form to input data into tblEmployees. On the
frmEmployeeData I have created a Combo Box that gives a choice of 5 regional
centers. Each of these centers has between 5 and 15 sites. I want to create
another combo box that will constrain the choices to the specific sites
based upon
which center is chosen by the Combo Box ctrHandlingCtr.
 
J

Jeff Boyce

Search on-line for "Cascading Comboboxes" (also try at mvps.org/access).

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

Doctor

With your site combo selected (whatever you called it? ctrSite) Click the ...
next to the Row Source on the Properties Data tab. Create a query with the
information that you want to know (e.g. SiteID, SiteName, HandlingCenterID)
Be sure to change the names to whatever your fields are.

In the query builder, in the criteria row for HandlingCenterID, right click
and select Build. In the expression builder dialog choose your form
(frmEmployeeData) then in the second column choose your first combo box
(ctrHandlingCenter). This will set the list of the second combo box to only
show sites for the selected center.

Then select your Center combo and click the events tab on the Properties
window and click the AfterUpdate. Click the ... and select "code builder" in
the following dialog. In Visual Basic window type: Me.NameOfSiteCombo.Requery

Then in the Properties for the form (if you don't know how to open this,
Select View |Properties Window, then close your form and reopen it in design
view. You can also get there by clicking the square where the two rulers meet
while in design view.) Go to the event tab. Click OnCurrent. Click the ...
and select "code builder" in the following dialog. In Visual Basic window
type: Me.NameOfSiteCombo.Requery

There you have it. Hope it helps.
Doc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top