PC Review


Reply
Thread Tools Rate Thread

Access Query - "Duplicate Records Selected"

 
 
Brent
Guest
Posts: n/a
 
      30th Apr 2010
Any help would be appreciated. When viewing records resulting from a
multiple table query, I discovered "Duplicate" records being selected.
However, all fields are not exactly the same, for the value selected from the
second table makes the record truly unique. How do I modify the query
statement to "output" only one occurance of the record? I tried unique value
for the "member number" field but the query still selected member 001 two
times.

--
Brent
 
Reply With Quote
 
 
 
 
Daryl S
Guest
Posts: n/a
 
      30th Apr 2010
Brent -

You need to tell Access how to decide which of the two fields is the one you
want output. This is usually done in a query by adding 'Totals' - use the
total button in query design view to add this row. Most of the fields will
have "Group by" in their totals row. For the field from the second table
that has more than one value, you need to choose something else. Some of the
options in this drop-list only work for numeric fields, like Sum or Average.
Others, like First, Max, etc. will work with other field types as well.
Select the appropriate one and run your query.

--
Daryl S


"Brent" wrote:

> Any help would be appreciated. When viewing records resulting from a
> multiple table query, I discovered "Duplicate" records being selected.
> However, all fields are not exactly the same, for the value selected from the
> second table makes the record truly unique. How do I modify the query
> statement to "output" only one occurance of the record? I tried unique value
> for the "member number" field but the query still selected member 001 two
> times.
>
> --
> Brent

 
Reply With Quote
 
Brent
Guest
Posts: n/a
 
      30th Apr 2010
Thanks for responding, however, I may not have been clear. Currently access
is outputing 2 records .... 1 with each "ture" value. Query: select code
>0and<1000


Code is stored in a separate table from rec num name & street.

id rec num code name Street
001 5498 123 B.O. SAM 123 Main
002 5498 549 B.O. SAM 123 Main

Problem.... I want only one record in my output.
would actually like one name and address record with all qualifing codes....
123,549.

lastly, the output would be printed on labels with the code or codes printed
above.
--
Brent


"Daryl S" wrote:

> Brent -
>
> You need to tell Access how to decide which of the two fields is the one you
> want output. This is usually done in a query by adding 'Totals' - use the
> total button in query design view to add this row. Most of the fields will
> have "Group by" in their totals row. For the field from the second table
> that has more than one value, you need to choose something else. Some of the
> options in this drop-list only work for numeric fields, like Sum or Average.
> Others, like First, Max, etc. will work with other field types as well.
> Select the appropriate one and run your query.
>
> --
> Daryl S
>
>
> "Brent" wrote:
>
> > Any help would be appreciated. When viewing records resulting from a
> > multiple table query, I discovered "Duplicate" records being selected.
> > However, all fields are not exactly the same, for the value selected from the
> > second table makes the record truly unique. How do I modify the query
> > statement to "output" only one occurance of the record? I tried unique value
> > for the "member number" field but the query still selected member 001 two
> > times.
> >
> > --
> > Brent

 
Reply With Quote
 
John W. Vinson
Guest
Posts: n/a
 
      30th Apr 2010
On Fri, 30 Apr 2010 13:01:03 -0700, Brent <(E-Mail Removed)>
wrote:

>Thanks for responding, however, I may not have been clear. Currently access
>is outputing 2 records .... 1 with each "ture" value. Query: select code
>>0and<1000

>
>Code is stored in a separate table from rec num name & street.
>
>id rec num code name Street
>001 5498 123 B.O. SAM 123 Main
>002 5498 549 B.O. SAM 123 Main
>
>Problem.... I want only one record in my output.
>would actually like one name and address record with all qualifing codes....
>123,549.
>
>lastly, the output would be printed on labels with the code or codes printed
>above.


You'll need some VBA code to make this practical. See

http://www.mvps.org/access/modules/mdl0004.htm

for a sample.
--

John W. Vinson [MVP]
 
Reply With Quote
 
Brent
Guest
Posts: n/a
 
      1st May 2010
John,

Thanks for the reference. Considering that I'm a beginner, this looks a
little overwhelming for me.

Is there a way for me to eliminate the "duplicate rec" from the query. If
possible, would like to eliminate it based on the "rec num" field. I'll deal
with multiply occuring codes later.

Thanks

--
Brent


"John W. Vinson" wrote:

> On Fri, 30 Apr 2010 13:01:03 -0700, Brent <(E-Mail Removed)>
> wrote:
>
> >Thanks for responding, however, I may not have been clear. Currently access
> >is outputing 2 records .... 1 with each "ture" value. Query: select code
> >>0and<1000

> >
> >Code is stored in a separate table from rec num name & street.
> >
> >id rec num code name Street
> >001 5498 123 B.O. SAM 123 Main
> >002 5498 549 B.O. SAM 123 Main
> >
> >Problem.... I want only one record in my output.
> >would actually like one name and address record with all qualifing codes....
> >123,549.
> >
> >lastly, the output would be printed on labels with the code or codes printed
> >above.

>
> You'll need some VBA code to make this practical. See
>
> http://www.mvps.org/access/modules/mdl0004.htm
>
> for a sample.
> --
>
> John W. Vinson [MVP]
> .
>

 
Reply With Quote
 
John W. Vinson
Guest
Posts: n/a
 
      1st May 2010
On Fri, 30 Apr 2010 16:54:06 -0700, Brent <(E-Mail Removed)>
wrote:

>John,
>
>Thanks for the reference. Considering that I'm a beginner, this looks a
>little overwhelming for me.
>
>Is there a way for me to eliminate the "duplicate rec" from the query. If
>possible, would like to eliminate it based on the "rec num" field. I'll deal
>with multiply occuring codes later.


Sure. Make it a Totals query; group by the four other fields, and choose First
(or Min or Max) for code to show at least one of the codes.

The VBA in the website is not at all hard to use. Simply copy and paste the
code from the "code start" through the "code end" lines into a new Module;
save the module under the name basConcatenate (any name other than
fConcatChild); choose Debug... Compile from the menu; and follow the
instructions. In this case you'ld put

Codes: fConcatChild("yourtablename", "RecNum", "Code", "Long", [RecNum])

in a vacant Field cell.

--

John W. Vinson [MVP]
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access Query "Show number 0 if no records are selected by counting" johan Microsoft Access 2 28th Jun 2008 01:13 PM
How to delete "non-identical" duplicate records in an Access table Ernest Monterrosa Microsoft Access Queries 3 12th Dec 2007 07:44 PM
How do I select "selected records" to print in Access? =?Utf-8?B?YnJpZ3V5?= Microsoft Access Reports 4 7th Mar 2007 01:27 PM
if access query has no records, output "no records found" =?Utf-8?B?U00=?= Microsoft Access Queries 3 17th Aug 2006 09:06 PM
Would like the "Print Range" default to be "Selected Records" =?Utf-8?B?RG9u?= Microsoft Access Forms 0 4th Dec 2003 03:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:44 PM.