Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Combo-box Forms? 1

Status
Not open for further replies.

gnealw

Programmer
May 6, 2003
6
US
Hello,

I am fairly new to this and I'm not sure of the proper way to accomplish this:

I have a form based on a table for contractors that includes a "type" field, (ie: Plumbing) and a "company" field, (ie: Joe's Plumbing).

What is the best approach to first choose the "type", then choose the "company". There are multiple types of contractors and multiple contractors of each type.

I have had success with running seperate queries from command buttons on a form, but I would like to do this simply from 2 integrated drop-down lists.

Any suggestions?
 
You should be able to do that easily. The Wizard should set it up for you - you can always change it later, if you want.

Are "Type" and "Contractor" fields in a table? If so, you can look them up from the table. If each contractor is assigned to a type, you can filter the contractor name based on the value in the "Type" field. Of course, if each contractor is in one (and only one) type, you don't really need to store the type in each record - just look it up based on the name.

 
Thanks, but I am looking for something else. I am building the database for a group of people that havn't been train in Access, so I am making it as user friendly as possible.

I have several methods that work, one being a form with nothing but queries ran by command buttons. That works great, but I have too many types to include a button for each one.

I am hoping to find a way to have a string of 2 combo-boxes...first you must choose the contractor type, then the company name box would only give you a choice of that type of contractors.

I believe this can be done, but I am not quite sure which method to research....Query?....Subform? I'm thinking that a subform will be the way to go, but I'll have to dis-mantle my tables.

Any more help?
 
That's pretty easy to do - you can use subforms, or two combo boxes. It depends on what you're going to do once you get the fields filled in.

Are you going to run a report, enter data, or what?

To get the second combo box to list only those contractors of the proper type:

Set up the "Type" combo box first. Call it something like "ComboType".

Now, set up the second combo box. Under the "Row Source" property, click on the [...] on the right side of the line to invoke the query builder. Select the table and fields you want to display. Under "Criteria" for the "Type" field of the query, enter:

Forms!yourformname.combotype

This will only show records that match the selection in the first combo box.

A subform would be easy to set up, too. I think there's a wizard that will pretty much do the work for you. Just click the icon on the toolbar, and follow the steps.

If it were me, I'd use the two combo boxes if I'm entering data, and all I want is an easy way to enter the contractor name and type.

If what I really want to do is display data based on the combo boxes, I might use a subform (depending on the circumstances).



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top