selecting a name in a combo box and everyone comes up

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created combo boxes for a database that has three drop down windows.
one for industry one for city and one for country. I have several contacts
from the same city for example and one name will be listed 10 times and so
forth. I want to make it so there is just one city name and when you select
it every person in the database who lives in that city will appear. i need
all three to do that. please help
 
For the row source of the combo boxes, you need to create the query to get
the DISTINCT values from the table.
It all sounds like you are drawing the values from the table that holds the
contact information.

For example:

Select Distinct IndustryName
From tblContacts
Order By IndustryName

Likewise...

Select Distinct City
From tblContacts
Order By City

Etc..


Now... for you to get the values that match the required selections
(assuming that all 3 must be selected):

You can create this as a query and then use the command button to open the
query (docmd.OpenQuery) to display the results.

Select *
From tblContacts
Where
Industry = "'" & Forms!<FormName>!cboIndustry & "'" AND
City = "'" & Forms!<FormName>!cboCity & "'" AND
Country = "'" & Forms!<FormName>!cboCounty & "'"

<FormName> is the name of the form where you have the 3 combo box controls.

HTH
--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
Back
Top