Excluding duplicates in a query

J

Jane

Hi there, I've got a 'print envelopes' report based on a parameter query (a
range of invoice numbers). Trouble is it prints duplicte addresses. I've
tried setting the Unique Values/Record properties in the query but that
doesn't remove the duplicates. Any ideas?
 
G

Gary Miller

Jane,

Try making the query a 'Totals' query and GroupBy the fields
that you need for your addresses.

Gary Miller
 
J

John Vinson

Hi there, I've got a 'print envelopes' report based on a parameter query (a
range of invoice numbers). Trouble is it prints duplicte addresses. I've
tried setting the Unique Values/Record properties in the query but that
doesn't remove the duplicates. Any ideas?

Please post the SQL of the query. You may have some extraneous field
that isn't printed but makes each record unique.
 
J

Jane

Thanks for your responses and here's the SQL. Showing Totals doesn't work,
btw.

SELECT DISTINCT tblCustomers.CompanyName, tblCustomers.Address1,
tblCustomers.Address2, tblCustomers.Town, tblCustomers.County,
tblCustomers.PostCode, tblInvoices.InvoiceNo, tblInvoices.Date
FROM tblCustomers INNER JOIN tblInvoices ON tblCustomers.CustomerID =
tblInvoices.CustomerID
WHERE (((tblCustomers.CompanyName)<>"Cash Sales") AND
((tblInvoices.InvoiceNo) Between [Type the first invoice no:] And [Type the
last invoice no:]))
ORDER BY tblInvoices.InvoiceNo;
 
J

Jane

All done. I created a second query, took out the unique field and viewed
totals.
Thanks for your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top