A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Duplicate Returns.



 
 
Thread Tools Display Modes
  #1  
Old November 26th, 2009, 07:58 PM posted to microsoft.public.access.queries
Andrew
external usenet poster
 
Posts: 688
Default Duplicate Returns.

Sometimes when I do a query, I get the record listed twice (or more) after
hitting Run. The records aren't duplicated in the table, so why am I getting
two results?
  #2  
Old November 27th, 2009, 02:46 AM posted to microsoft.public.access.queries
Allen Browne
external usenet poster
 
Posts: 11,706
Default Duplicate Returns.

If your query uses multiple tables with one-to-many relations, the records
from the ONE side of the relation will appear on as many rows as there are
records in the related table.

For example, if you have tables for Customers, Invoices, and Payments. If an
invoice was paid in 2 instalments, the invoice will appear twice because
there are 2 payments for it.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Andrew" wrote in message
...
Sometimes when I do a query, I get the record listed twice (or more) after
hitting Run. The records aren't duplicated in the table, so why am I
getting
two results?


  #3  
Old November 27th, 2009, 04:48 AM posted to microsoft.public.access.queries
Andrew
external usenet poster
 
Posts: 688
Default Duplicate Returns.

Thanks. I thought of that as soon as I posted this.

Is there any easy way to tell Access to only list each record once? Even if
there is multiple entries in another table?

"Allen Browne" wrote:

If your query uses multiple tables with one-to-many relations, the records
from the ONE side of the relation will appear on as many rows as there are
records in the related table.

For example, if you have tables for Customers, Invoices, and Payments. If an
invoice was paid in 2 instalments, the invoice will appear twice because
there are 2 payments for it.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Andrew" wrote in message
...
Sometimes when I do a query, I get the record listed twice (or more) after
hitting Run. The records aren't duplicated in the table, so why am I
getting
two results?


.

  #4  
Old November 27th, 2009, 07:35 AM posted to microsoft.public.access.queries
Allen Browne
external usenet poster
 
Posts: 11,706
Default Duplicate Returns.

Create a query on just the other table. In that query, GROUP BY the field
that should appear once only, and choose First or Sum or whatever for the
other field(s.)

Then use that query as an input 'table' for your main query, instead of the
problem table. Since it only has ONE record for each key field, you won't
get duplicated records.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Andrew" wrote in message
...
Thanks. I thought of that as soon as I posted this.

Is there any easy way to tell Access to only list each record once? Even
if
there is multiple entries in another table?

"Allen Browne" wrote:

If your query uses multiple tables with one-to-many relations, the
records
from the ONE side of the relation will appear on as many rows as there
are
records in the related table.

For example, if you have tables for Customers, Invoices, and Payments. If
an
invoice was paid in 2 instalments, the invoice will appear twice because
there are 2 payments for it.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Andrew" wrote in message
...
Sometimes when I do a query, I get the record listed twice (or more)
after
hitting Run. The records aren't duplicated in the table, so why am I
getting
two results?


.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:23 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.