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 Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Mail Merge two fields that have multiple lines with new line control code



 
 
Thread Tools Display Modes
  #1  
Old May 20th, 2004, 03:23 AM
Eric Li
external usenet poster
 
Posts: n/a
Default Mail Merge two fields that have multiple lines with new line control code

Hi,

I am using MailMerge.OpenDataSource to merge many fields. There are two
fields are multiple lines with new line control code in it ("\n"). I can
merge only one field (has multiple lines) without any problem but when
merging two fields (both have multiple lines), I got the following error:

"Data fields must be separated from each other by a character called a field
delimiter. Similarly, data records must be separated by a record delimiter.
Use the lists below to select the appropriate delimiter."

I am using "^" as my delimiter and can't find any wrong with my delimiter.
As long as I only use one field that has multiple lines, it will be OK, even
I have other fields that have only one line value.

Any idea?

Thanks in advance.

Eric


  #2  
Old May 20th, 2004, 04:17 PM
Cindy M -WordMVP-
external usenet poster
 
Posts: n/a
Default Mail Merge two fields that have multiple lines with new line control code

Hi Eric,

Which version of Word is this?

I assume the data source is a text file. And are you using a "new line"
generated by pressing the Enter key (Chr(13) or some combination with that
character) as the record delimiter? Or something else (you don't specify which
kind of delimiter the ^ is...)?

Have you placed each field's content in "quotes"?

I am using MailMerge.OpenDataSource to merge many fields. There are two
fields are multiple lines with new line control code in it ("\n"). I can
merge only one field (has multiple lines) without any problem but when
merging two fields (both have multiple lines), I got the following error:

"Data fields must be separated from each other by a character called a field
delimiter. Similarly, data records must be separated by a record delimiter.
Use the lists below to select the appropriate delimiter."

I am using "^" as my delimiter and can't find any wrong with my delimiter.
As long as I only use one field that has multiple lines, it will be OK, even
I have other fields that have only one line value.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

  #3  
Old May 20th, 2004, 06:06 PM
Eric Li
external usenet poster
 
Posts: n/a
Default Mail Merge two fields that have multiple lines with new line control code

Hi, Cindy,

Thank you for reply.

I am using C# to generate my contents for each field.

For example, I have the following values for one field:

"this is first line\n" + "this is second line\n" + "this is last line"

and I am using "^" as my delimiter for each field pair.

Yes, I have tried add "quotes" to my content but still didn't work.

Thanks for spending your time for me. :-)

Eric


"Cindy M -WordMVP-" wrote in message
news:VA.0000985a.00cd3543@speedy...
Hi Eric,

Which version of Word is this?

I assume the data source is a text file. And are you using a "new line"
generated by pressing the Enter key (Chr(13) or some combination with that
character) as the record delimiter? Or something else (you don't specify

which
kind of delimiter the ^ is...)?

Have you placed each field's content in "quotes"?

I am using MailMerge.OpenDataSource to merge many fields. There are two
fields are multiple lines with new line control code in it ("\n"). I can
merge only one field (has multiple lines) without any problem but when
merging two fields (both have multiple lines), I got the following

error:

"Data fields must be separated from each other by a character called a

field
delimiter. Similarly, data records must be separated by a record

delimiter.
Use the lists below to select the appropriate delimiter."

I am using "^" as my delimiter and can't find any wrong with my

delimiter.
As long as I only use one field that has multiple lines, it will be OK,

even
I have other fields that have only one line value.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)



  #4  
Old May 20th, 2004, 06:25 PM
Eric Li
external usenet poster
 
Posts: n/a
Default Mail Merge two fields that have multiple lines with new line control code

Hi, Cindy,

I finally found out what's going on. It's my mistake.

When I created the text file, I enter a carriage return on the last line.
That's the problem. Once I remove the carriage return. Everything is working
fine. Thanks for your help.


Eric


"Cindy M -WordMVP-" wrote in message
news:VA.0000985a.00cd3543@speedy...
Hi Eric,

Which version of Word is this?

I assume the data source is a text file. And are you using a "new line"
generated by pressing the Enter key (Chr(13) or some combination with that
character) as the record delimiter? Or something else (you don't specify

which
kind of delimiter the ^ is...)?

Have you placed each field's content in "quotes"?

I am using MailMerge.OpenDataSource to merge many fields. There are two
fields are multiple lines with new line control code in it ("\n"). I can
merge only one field (has multiple lines) without any problem but when
merging two fields (both have multiple lines), I got the following

error:

"Data fields must be separated from each other by a character called a

field
delimiter. Similarly, data records must be separated by a record

delimiter.
Use the lists below to select the appropriate delimiter."

I am using "^" as my delimiter and can't find any wrong with my

delimiter.
As long as I only use one field that has multiple lines, it will be OK,

even
I have other fields that have only one line value.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)



  #5  
Old May 21st, 2004, 03:26 PM
Cindy M -WordMVP-
external usenet poster
 
Posts: n/a
Default Mail Merge two fields that have multiple lines with new line control code

Hi Eric,

I finally found out what's going on. It's my mistake.

When I created the text file, I enter a carriage return on the last line.
That's the problem. Once I remove the carriage return. Everything is working
fine.

Glad you tracked it down :-)

Cindy Meister

  #6  
Old May 25th, 2004, 12:05 AM
Eric Li
external usenet poster
 
Posts: n/a
Default Mail Merge two fields that have multiple lines with new line control code

Hi, Cindy,

Now I have another issue. The mailmerge function that I used in Word 2000 is
OK but it doesn't work on Word 2002. The text file that I used is identical
in Word 2000 and 2002. Is there any difference between 2000 and 2002 when
you create text file for mailmerge?

The error I got is "This merge field is used in the main document, but it
does not exist in the data source".

Here is my text file example:

field 1^field 2^field 3
"data 1"^"data 2"^"data 3"

I am using "^" as my field delimiter and carriage return as my record
delimiter.

Do you have any idea? Thanks.



Eric


"Cindy M -WordMVP-" wrote in message
news:VA.0000987d.00ea97f8@speedy...
Hi Eric,

I finally found out what's going on. It's my mistake.

When I created the text file, I enter a carriage return on the last

line.
That's the problem. Once I remove the carriage return. Everything is

working
fine.

Glad you tracked it down :-)

Cindy Meister



  #7  
Old May 25th, 2004, 04:07 PM
Cindy M -WordMVP-
external usenet poster
 
Posts: n/a
Default Mail Merge two fields that have multiple lines with new line control code

Hi Eric,

the most obvious difference between Word 2000 and 2002 is that the latter uses
OLE DB by default to connect to the data, while Word 2000 will use either
Word's internal text converter or possibly ODBC.

If you change the file extension of the text file to something really
abstruse, such as *.prn, then test in both versions, what kinds of results do
you get?

Now I have another issue. The mailmerge function that I used in Word 2000 is
OK but it doesn't work on Word 2002. The text file that I used is identical
in Word 2000 and 2002. Is there any difference between 2000 and 2002 when
you create text file for mailmerge?

The error I got is "This merge field is used in the main document, but it
does not exist in the data source".

Here is my text file example:

field 1^field 2^field 3
"data 1"^"data 2"^"data 3"

I am using "^" as my field delimiter and carriage return as my record
delimiter.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

  #8  
Old May 25th, 2004, 06:10 PM
Eric Li
external usenet poster
 
Posts: n/a
Default Mail Merge two fields that have multiple lines with new line control code

Hi, Cindy,

You are right. It's the internal text converter issue.

If I use "\r" (carriage return) only as my record delimiter in Word 2000, it
is OK but it is not OK in Word 2002. I have to use "\r\n" (carriage return +
new line) as record delimiter in Word 2002.

The file extension that I use for my text file is "DOC". Therefore, Word
2002 is using DOC converter to interpreter "\r". I will try to use different
extension.

By the way, is there any length limitation for field ID? I am using a very
long field ID but Word 2002 will truncated my field ID and mailmerge can't
recognize the field any more.


Thanks.


Eric




"Cindy M -WordMVP-" wrote in message
news:VA.000098f8.009b1ac9@speedy...
Hi Eric,

the most obvious difference between Word 2000 and 2002 is that the latter

uses
OLE DB by default to connect to the data, while Word 2000 will use either
Word's internal text converter or possibly ODBC.

If you change the file extension of the text file to something really
abstruse, such as *.prn, then test in both versions, what kinds of results

do
you get?

Now I have another issue. The mailmerge function that I used in Word

2000 is
OK but it doesn't work on Word 2002. The text file that I used is

identical
in Word 2000 and 2002. Is there any difference between 2000 and 2002

when
you create text file for mailmerge?

The error I got is "This merge field is used in the main document, but

it
does not exist in the data source".

Here is my text file example:

field 1^field 2^field 3
"data 1"^"data 2"^"data 3"

I am using "^" as my field delimiter and carriage return as my record
delimiter.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)



 




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 12:31 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.