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

Avoid Duplicates using SQL

Status
Not open for further replies.

Beard36

Programmer
Sep 4, 2003
69
GB
This should just be a quickie, it's just that I've been looking round and can't find the answer! (Disclaimer: I've only recently started dipping into Access and SQL and while it's mostly making sense, there are holes in my knowledge like this one)

On a form I've got a combobox which is populated with values from the main table (Surnames in this case). The rowsource is just

"SELECT Patients.Surname FROM Patients ORDER BY Patients.Surname;"

What I want to do is avoid duplicates - if I have two people Dan Roberts and Jeff Roberts in my records, I only want one entry for Roberts in this combobox. I can't see any property for the combobox in Design View so I presume (hope!) that there is a SQL option that I haven't been able to find yet.

If anyone could just nudge me in the right direction it would be greatly appreciated.

Cheers!
 
SELECT DISTINCT Patients.Surname FROM Patients ORDER BY Patients.Surname;
 
SELECT DISTINCT Patients.Surname FROM Patients ORDER BY Patients.Surname;
 
Ah, cheers! I had seen that around now that you mention it, but you know when you're trying to get your head round (ie. remember) lots of different things at once, some of them seem to get lost in the process!

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top