Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
dan
 
Posts: n/a
Default not merging duplicate records

Hello listers

I saw your code on the cindy meister website regarding suppressing
duplicates in a mail merge. I unfortaunately am not able to follow it very
well.

I have a data source with a bunch of fields. I only need 2 of the fields in
my mail merge document. When I merge them to my template I get lots of
multiples when I really need only one of each.

I am making labels for pricing items and have the following data source
model

itemnumber itemprice itemdescription itemmodel
1234 24.95 item1yellow 2
1234 24.95 item1gree 3
1234 24.95 item1blue 4
1234 24.95 item1red 5
4321 32.95 item1yellow 1
4321 32.95 item1orange 1

etc

but when i run a mail merge to make the labels i only need the item number
and the price since they are all the same. But running a normal mail merge
gives me 5 labels for item 1234 and two labels for 4321 when i really only
need two labels total as there are only two different item numbers.

If you could help me work through this or offer any code as to how to
accomplish this it would be greatly appreciated.

Altering the data source is not an option.

Thanks in advance!!!
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default not merging duplicate records

How best to do this depends upon the datasource. If it is a table in an
Access database, it is very easy to do using a query.

If, it's in Excel, it can be done, using and IF() function construction and
then doing a sort.

If it's in Word, you will find some information of eliminating duplicates in
the article "Finding and replacing characters using wildcards" at:

http://www.word.mvps.org/FAQs/Genera...gWildcards.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"dan" wrote in message
. ..
Hello listers

I saw your code on the cindy meister website regarding suppressing
duplicates in a mail merge. I unfortaunately am not able to follow it very
well.

I have a data source with a bunch of fields. I only need 2 of the fields
in
my mail merge document. When I merge them to my template I get lots of
multiples when I really need only one of each.

I am making labels for pricing items and have the following data source
model

itemnumber itemprice itemdescription itemmodel
1234 24.95 item1yellow 2
1234 24.95 item1gree 3
1234 24.95 item1blue 4
1234 24.95 item1red 5
4321 32.95 item1yellow 1
4321 32.95 item1orange 1

etc

but when i run a mail merge to make the labels i only need the item number
and the price since they are all the same. But running a normal mail merge
gives me 5 labels for item 1234 and two labels for 4321 when i really only
need two labels total as there are only two different item numbers.

If you could help me work through this or offer any code as to how to
accomplish this it would be greatly appreciated.

Altering the data source is not an option.

Thanks in advance!!!



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default not merging duplicate records

In addition to Doug's reply, even if "altering the data source is not an
option" you may be able to open the data source using a query in a VBA
OpenDataSource statement in a way that eliminates the duplicates. However,
it depends on what type of data source you have.

Peter Jamieson

"dan" wrote in message
. ..
Hello listers

I saw your code on the cindy meister website regarding suppressing
duplicates in a mail merge. I unfortaunately am not able to follow it very
well.

I have a data source with a bunch of fields. I only need 2 of the fields
in
my mail merge document. When I merge them to my template I get lots of
multiples when I really need only one of each.

I am making labels for pricing items and have the following data source
model

itemnumber itemprice itemdescription itemmodel
1234 24.95 item1yellow 2
1234 24.95 item1gree 3
1234 24.95 item1blue 4
1234 24.95 item1red 5
4321 32.95 item1yellow 1
4321 32.95 item1orange 1

etc

but when i run a mail merge to make the labels i only need the item number
and the price since they are all the same. But running a normal mail merge
gives me 5 labels for item 1234 and two labels for 4321 when i really only
need two labels total as there are only two different item numbers.

If you could help me work through this or offer any code as to how to
accomplish this it would be greatly appreciated.

Altering the data source is not an option.

Thanks in advance!!!



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Dan
 
Posts: n/a
Default not merging duplicate records

Hi all-

Thanks Peter thats an interesting concept that I hadn't considered.

My data source is a flat text file - tab delimited.


Thanks for any advise..

"Peter Jamieson" wrote:

In addition to Doug's reply, even if "altering the data source is not an
option" you may be able to open the data source using a query in a VBA
OpenDataSource statement in a way that eliminates the duplicates. However,
it depends on what type of data source you have.

Peter Jamieson

"dan" wrote in message
. ..
Hello listers

I saw your code on the cindy meister website regarding suppressing
duplicates in a mail merge. I unfortaunately am not able to follow it very
well.

I have a data source with a bunch of fields. I only need 2 of the fields
in
my mail merge document. When I merge them to my template I get lots of
multiples when I really need only one of each.

I am making labels for pricing items and have the following data source
model

itemnumber itemprice itemdescription itemmodel
1234 24.95 item1yellow 2
1234 24.95 item1gree 3
1234 24.95 item1blue 4
1234 24.95 item1red 5
4321 32.95 item1yellow 1
4321 32.95 item1orange 1

etc

but when i run a mail merge to make the labels i only need the item number
and the price since they are all the same. But running a normal mail merge
gives me 5 labels for item 1234 and two labels for 4321 when i really only
need two labels total as there are only two different item numbers.

If you could help me work through this or offer any code as to how to
accomplish this it would be greatly appreciated.

Altering the data source is not an option.

Thanks in advance!!!




  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Dan
 
Posts: n/a
Default not merging duplicate records

To follow up...

I m not saying that Cindy's method wont work. As a matter of fact I would
like a template-side solution like that. I merely cant figure out for the
life of me how to convert her solution there to work for my data model. If
you guys are proficient with this and can help that would be greatly
apreciated.

Again my data source si a flat text file, tab delimited and looks like this:

itemnumber itemprice itemdescription itemmodel
1234 24.95 item1yellow 2
1234 24.95 item1gree 3
1234 24.95 item1blue 4
1234 24.95 item1red 5
4321 32.95 item1yellow 1
4321 32.95 item1orange 1


I need to make labels like this for example:

1234
24.95

4321
32.95

I only need one label per product number/price despite the multiple records
for each product(a result of different colors/sizes/etc. - but prices are
still the same)


Thanks again!!!!
"Dan" wrote:

Hi all-

Thanks Peter thats an interesting concept that I hadn't considered.

My data source is a flat text file - tab delimited.


Thanks for any advise..

"Peter Jamieson" wrote:

In addition to Doug's reply, even if "altering the data source is not an
option" you may be able to open the data source using a query in a VBA
OpenDataSource statement in a way that eliminates the duplicates. However,
it depends on what type of data source you have.

Peter Jamieson

"dan" wrote in message
. ..
Hello listers

I saw your code on the cindy meister website regarding suppressing
duplicates in a mail merge. I unfortaunately am not able to follow it very
well.

I have a data source with a bunch of fields. I only need 2 of the fields
in
my mail merge document. When I merge them to my template I get lots of
multiples when I really need only one of each.

I am making labels for pricing items and have the following data source
model

itemnumber itemprice itemdescription itemmodel
1234 24.95 item1yellow 2
1234 24.95 item1gree 3
1234 24.95 item1blue 4
1234 24.95 item1red 5
4321 32.95 item1yellow 1
4321 32.95 item1orange 1

etc

but when i run a mail merge to make the labels i only need the item number
and the price since they are all the same. But running a normal mail merge
gives me 5 labels for item 1234 and two labels for 4321 when i really only
need two labels total as there are only two different item numbers.

If you could help me work through this or offer any code as to how to
accomplish this it would be greatly appreciated.

Altering the data source is not an option.

Thanks in advance!!!






  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default not merging duplicate records

Unfortunately, there are a few errors in the construction given on Cindy's
site. It should be

{ IF { REF Check } "{ MERGEFIELD itemnumber } { MERGEFIELD itemprice } "
"{ MERGEFIELD itemnumber } { MERGEFIELD itemprice }¶
" }{ SET Check "{ MERGEFIELD itemnumber } { MERGEFIELD itemprice }" }

Where the ¶ appears in the above construction, you must press the enter key.

When I execute a merge containing the above construction, I receive an error
message about a field calculation error in the first field. However,
clicking OK results in the merge being executed to give the desired result.

When you execute the merge, a bookmark is inserted named Check is inserted
into the main document. If you wish to re-execute the merge, it is
necessary to first delete that bookmark.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Dan" wrote in message
...
To follow up...

I m not saying that Cindy's method wont work. As a matter of fact I would
like a template-side solution like that. I merely cant figure out for the
life of me how to convert her solution there to work for my data model. If
you guys are proficient with this and can help that would be greatly
apreciated.

Again my data source si a flat text file, tab delimited and looks like
this:

itemnumber itemprice itemdescription itemmodel
1234 24.95 item1yellow 2
1234 24.95 item1gree 3
1234 24.95 item1blue 4
1234 24.95 item1red 5
4321 32.95 item1yellow 1
4321 32.95 item1orange 1


I need to make labels like this for example:

1234
24.95

4321
32.95

I only need one label per product number/price despite the multiple
records
for each product(a result of different colors/sizes/etc. - but prices are
still the same)


Thanks again!!!!
"Dan" wrote:

Hi all-

Thanks Peter thats an interesting concept that I hadn't considered.

My data source is a flat text file - tab delimited.


Thanks for any advise..

"Peter Jamieson" wrote:

In addition to Doug's reply, even if "altering the data source is not
an
option" you may be able to open the data source using a query in a VBA
OpenDataSource statement in a way that eliminates the duplicates.
However,
it depends on what type of data source you have.

Peter Jamieson

"dan" wrote in message
. ..
Hello listers

I saw your code on the cindy meister website regarding suppressing
duplicates in a mail merge. I unfortaunately am not able to follow it
very
well.

I have a data source with a bunch of fields. I only need 2 of the
fields
in
my mail merge document. When I merge them to my template I get lots
of
multiples when I really need only one of each.

I am making labels for pricing items and have the following data
source
model

itemnumber itemprice itemdescription itemmodel
1234 24.95 item1yellow 2
1234 24.95 item1gree 3
1234 24.95 item1blue 4
1234 24.95 item1red 5
4321 32.95 item1yellow 1
4321 32.95 item1orange 1

etc

but when i run a mail merge to make the labels i only need the item
number
and the price since they are all the same. But running a normal mail
merge
gives me 5 labels for item 1234 and two labels for 4321 when i really
only
need two labels total as there are only two different item numbers.

If you could help me work through this or offer any code as to how to
accomplish this it would be greatly appreciated.

Altering the data source is not an option.

Thanks in advance!!!





  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default not merging duplicate records

OK, you may be able to do this another way, but if you have an ODBC User or
System DSN called "Delimited Text Files" that uses the MS Text Driver, and
your file is called c:\myfiles\myitems.txt then you would need:
a. a plain text file called SCHEMA.INI (this is normally created in the
ODBC Admnistartor utility but you can create or edit it in Notepad) in
c:\myfiles with the following content (at least):

[myitems.txt]

ColNameHeader=True

Format=TabDelimited

MaxScanRows=25



(you might also need

CharacterSet=OEM

or

CharacterSet=ANSI

)



Run a macro such as the following to set up the data source (once you have
done this, the document should be connected to the data source for good, as
long as Word's security does not get in the way).


Sub OpenNoDuplicates()
' Disconnect from any existing source (you will lose sort sequence and
filters)
ActiveDocument.MailMerge.MainDocumentType = wdNotAMergeDocument
' Use whatever merge type you need instead of wdCatalog
ActiveDocument.MailMerge.MainDocumentType = wdCatalog
ActiveDocument.MailMerge.OpenDataSource _
Name:="", _
Connection:="DSN=Delimited Text
Files;DBQ=c:\myfiles;DefaultDir=c:\myfiles;DriverI d=27;FIL=text;", _
SQLStatement:="SELECT DISTINCT itemnumber,itemprice FROM myitems.txt", _
SubType:=wdMergeSubTypeWord2000
End Sub

Peter Jamieson

"Dan" wrote in message
...
Hi all-

Thanks Peter thats an interesting concept that I hadn't considered.

My data source is a flat text file - tab delimited.


Thanks for any advise..

"Peter Jamieson" wrote:

In addition to Doug's reply, even if "altering the data source is not an
option" you may be able to open the data source using a query in a VBA
OpenDataSource statement in a way that eliminates the duplicates.
However,
it depends on what type of data source you have.

Peter Jamieson

"dan" wrote in message
. ..
Hello listers

I saw your code on the cindy meister website regarding suppressing
duplicates in a mail merge. I unfortaunately am not able to follow it
very
well.

I have a data source with a bunch of fields. I only need 2 of the
fields
in
my mail merge document. When I merge them to my template I get lots of
multiples when I really need only one of each.

I am making labels for pricing items and have the following data source
model

itemnumber itemprice itemdescription itemmodel
1234 24.95 item1yellow 2
1234 24.95 item1gree 3
1234 24.95 item1blue 4
1234 24.95 item1red 5
4321 32.95 item1yellow 1
4321 32.95 item1orange 1

etc

but when i run a mail merge to make the labels i only need the item
number
and the price since they are all the same. But running a normal mail
merge
gives me 5 labels for item 1234 and two labels for 4321 when i really
only
need two labels total as there are only two different item numbers.

If you could help me work through this or offer any code as to how to
accomplish this it would be greatly appreciated.

Altering the data source is not an option.

Thanks in advance!!!






  #8   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Dan
 
Posts: n/a
Default not merging duplicate records

Thanks Doug - yep i m getting some errors but its kinda working.

The biggest issue is that it just leaves a blank space where the duplicates
are/should be. Is there any way to advance to the next unique record for the
next field? So if I'm printing labels I dont have all these blank spots where
the duplicates would be, I'd like to fill them into the next available
mergefield cell so to speak

does that make sense?

Thanks

"Doug Robbins - Word MVP" wrote:

Unfortunately, there are a few errors in the construction given on Cindy's
site. It should be

{ IF { REF Check } "{ MERGEFIELD itemnumber } { MERGEFIELD itemprice } "
"{ MERGEFIELD itemnumber } { MERGEFIELD itemprice }¶
" }{ SET Check "{ MERGEFIELD itemnumber } { MERGEFIELD itemprice }" }

Where the ¶ appears in the above construction, you must press the enter key.

When I execute a merge containing the above construction, I receive an error
message about a field calculation error in the first field. However,
clicking OK results in the merge being executed to give the desired result.

When you execute the merge, a bookmark is inserted named Check is inserted
into the main document. If you wish to re-execute the merge, it is
necessary to first delete that bookmark.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Dan" wrote in message
...
To follow up...

I m not saying that Cindy's method wont work. As a matter of fact I would
like a template-side solution like that. I merely cant figure out for the
life of me how to convert her solution there to work for my data model. If
you guys are proficient with this and can help that would be greatly
apreciated.

Again my data source si a flat text file, tab delimited and looks like
this:

itemnumber itemprice itemdescription itemmodel
1234 24.95 item1yellow 2
1234 24.95 item1gree 3
1234 24.95 item1blue 4
1234 24.95 item1red 5
4321 32.95 item1yellow 1
4321 32.95 item1orange 1


I need to make labels like this for example:

1234
24.95

4321
32.95

I only need one label per product number/price despite the multiple
records
for each product(a result of different colors/sizes/etc. - but prices are
still the same)


Thanks again!!!!
"Dan" wrote:

Hi all-

Thanks Peter thats an interesting concept that I hadn't considered.

My data source is a flat text file - tab delimited.


Thanks for any advise..

"Peter Jamieson" wrote:

In addition to Doug's reply, even if "altering the data source is not
an
option" you may be able to open the data source using a query in a VBA
OpenDataSource statement in a way that eliminates the duplicates.
However,
it depends on what type of data source you have.

Peter Jamieson

"dan" wrote in message
. ..
Hello listers

I saw your code on the cindy meister website regarding suppressing
duplicates in a mail merge. I unfortaunately am not able to follow it
very
well.

I have a data source with a bunch of fields. I only need 2 of the
fields
in
my mail merge document. When I merge them to my template I get lots
of
multiples when I really need only one of each.

I am making labels for pricing items and have the following data
source
model

itemnumber itemprice itemdescription itemmodel
1234 24.95 item1yellow 2
1234 24.95 item1gree 3
1234 24.95 item1blue 4
1234 24.95 item1red 5
4321 32.95 item1yellow 1
4321 32.95 item1orange 1

etc

but when i run a mail merge to make the labels i only need the item
number
and the price since they are all the same. But running a normal mail
merge
gives me 5 labels for item 1234 and two labels for 4321 when i really
only
need two labels total as there are only two different item numbers.

If you could help me work through this or offer any code as to how to
accomplish this it would be greatly appreciated.

Altering the data source is not an option.

Thanks in advance!!!






  #9   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default not merging duplicate records

It makes sense but I don't think there's a way to do it using fields, hence
the "modify the data source approach". Trouble is, that's not particularly
easy either. You could also consider doing one merge to eliminate the
duplicates using Cindy's method and a catalog merge, then use the document
produced by that as the source for a second merge.

Peter Jamieson
"Dan" wrote in message
...
Thanks Doug - yep i m getting some errors but its kinda working.

The biggest issue is that it just leaves a blank space where the
duplicates
are/should be. Is there any way to advance to the next unique record for
the
next field? So if I'm printing labels I dont have all these blank spots
where
the duplicates would be, I'd like to fill them into the next available
mergefield cell so to speak

does that make sense?

Thanks

"Doug Robbins - Word MVP" wrote:

Unfortunately, there are a few errors in the construction given on
Cindy's
site. It should be

{ IF { REF Check } "{ MERGEFIELD itemnumber } { MERGEFIELD itemprice }
"
"{ MERGEFIELD itemnumber } { MERGEFIELD itemprice }¶
" }{ SET Check "{ MERGEFIELD itemnumber } { MERGEFIELD itemprice }" }

Where the ¶ appears in the above construction, you must press the enter
key.

When I execute a merge containing the above construction, I receive an
error
message about a field calculation error in the first field. However,
clicking OK results in the merge being executed to give the desired
result.

When you execute the merge, a bookmark is inserted named Check is
inserted
into the main document. If you wish to re-execute the merge, it is
necessary to first delete that bookmark.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Dan" wrote in message
...
To follow up...

I m not saying that Cindy's method wont work. As a matter of fact I
would
like a template-side solution like that. I merely cant figure out for
the
life of me how to convert her solution there to work for my data model.
If
you guys are proficient with this and can help that would be greatly
apreciated.

Again my data source si a flat text file, tab delimited and looks like
this:

itemnumber itemprice itemdescription itemmodel
1234 24.95 item1yellow 2
1234 24.95 item1gree 3
1234 24.95 item1blue 4
1234 24.95 item1red 5
4321 32.95 item1yellow 1
4321 32.95 item1orange 1


I need to make labels like this for example:

1234
24.95

4321
32.95

I only need one label per product number/price despite the multiple
records
for each product(a result of different colors/sizes/etc. - but prices
are
still the same)


Thanks again!!!!
"Dan" wrote:

Hi all-

Thanks Peter thats an interesting concept that I hadn't considered.

My data source is a flat text file - tab delimited.


Thanks for any advise..

"Peter Jamieson" wrote:

In addition to Doug's reply, even if "altering the data source is
not
an
option" you may be able to open the data source using a query in a
VBA
OpenDataSource statement in a way that eliminates the duplicates.
However,
it depends on what type of data source you have.

Peter Jamieson

"dan" wrote in message
. ..
Hello listers

I saw your code on the cindy meister website regarding suppressing
duplicates in a mail merge. I unfortaunately am not able to follow
it
very
well.

I have a data source with a bunch of fields. I only need 2 of the
fields
in
my mail merge document. When I merge them to my template I get
lots
of
multiples when I really need only one of each.

I am making labels for pricing items and have the following data
source
model

itemnumber itemprice itemdescription itemmodel
1234 24.95 item1yellow 2
1234 24.95 item1gree 3
1234 24.95 item1blue 4
1234 24.95 item1red 5
4321 32.95 item1yellow 1
4321 32.95 item1orange 1

etc

but when i run a mail merge to make the labels i only need the
item
number
and the price since they are all the same. But running a normal
mail
merge
gives me 5 labels for item 1234 and two labels for 4321 when i
really
only
need two labels total as there are only two different item
numbers.

If you could help me work through this or offer any code as to how
to
accomplish this it would be greatly appreciated.

Altering the data source is not an option.

Thanks in advance!!!








Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Next Record If, problems with merging multiple records [email protected] Mailmerge 0 January 13th 06 05:38 PM
Merging 2 or more records into 1 page tye Mailmerge 5 December 1st 05 10:47 PM
Duplicate Records Merging with Access markmidwest Mailmerge 3 June 13th 05 07:10 PM
Problems merging many records on a single page Carl Mercier Mailmerge 1 January 16th 05 01:27 AM
Merging data from two consecutive access records in Word 2002 Frank Spade Mailmerge 3 December 17th 04 10:51 AM


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

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"