Solved

How can I remove duplicates from list box

Posted on 2008-10-14
2
286 Views
Last Modified: 2012-05-05
Hi experts,

I have the following SQL statement:

SELECT DISTINCT XKIncidentTasks.IncidentTaskID, XKIncidentTasks.Sequence, XKIncidentTasks.IncidentTask, XKIncidentTasks.IncidentTaskDuration
FROM XKIncidentTasks
ORDER BY XKIncidentTasks.Sequence;


My table XKIncidentTasks contains 59 records. All have an autonumber which is "IncidentTaskID".  Around 15 of these records all contain the same text in the field "IncidentTask".  I would like to remove these 15 records from my list box.  I do not want to delete them from the table.

I have tried using the DISTINCT coding in my SQL but this does not work because Access does not see any duplicate records due to the "IncidentTaskID" field.  I need the "IncidentTaskID" to be present in my list box.

Can anybody help me?

Thank you.
Terry
0
Comment
Question by:TerenceHewett
2 Comments
 
LVL 2

Accepted Solution

by:
Monky42 earned 500 total points
Comment Utility
add GROUP BY XKIncidentTasks.IncidentTask
Then DISTINCT will make sure only mutually different IncidentTasks are shown.
0
 

Author Comment

by:TerenceHewett
Comment Utility
Thank you very much for your help.  This worked a treat.  All I needed to do was Group the IncidentTask and "Sum" the rest of my fields in the query.

Best regards
Terry
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now