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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DISTINCT combobox filter help

Status
Not open for further replies.

DSGF

Technical User
Mar 22, 2008
17
US
Ok..., I'm going nuts.
I have a larger project that I can't get to work, but for the sake of simplicity I have made a basic test that is still not working.

I have s table called Personal
Personal contains ID, FN, LN, Street, City, State, and Zip.
Personal contains 10 records, 3 from NJ, 5 from PA and 2 from RI.

I have a form called form1.
form1 one shows all 10 Personal and related info.
I have a drop-down that I want only to show DISTINCT values from the States. The after update event will filter form1. This I can do and is not a problem.

The trouble is that it continues to show all 10 states and not just one NJ, one PA and one RI.

My Combobox Row Source is:
SELECT DISTINCT Reprsentatives.ID1, Reprsentatives.State FROM Reprsentatives ORDER BY Reprsentatives.State;

......it continues to show all 10 States from all of the records. What am I doing wrong????

 
The reason is
SELECT DISTINCT Reprsentatives.ID1, Reprsentatives.State
This means it will return all distinct combination of ID1 and State. If you 10 1d1 then you have 10 distinct combinations. If you
SELECT DISTINCT Reprsentatives.State
you will get just the distinct states
 
Thank you MajP
I did think this was the reason so I tried SELECT DISTINCT Reprsentatives.State and the box shows up empty. Interestingly it seems to now have just 3 spaces in the drop down but no text is displayed. Any thoughts?
 
look at your
column count
column widths
properties.
 
Your Great! That was it. You can tell I'm a newbe. Thanks for your help!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top