Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Chris Stammers Chris Stammers is offline
external usenet poster
 
Posts: 46
Default Mergefield Formatting - Trim function? Word 2000

Hello,

Is there a way of 'trimming' a field in a merge? I have been supplied a data
file and one of the fields has trailing spaces which are being read as
character spaces. I suspect it is just a case of 'ask the person supplying
the data to correct it' however I just thought I would ask.

Many thanks,
Chris


  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Chris Stammers Chris Stammers is offline
external usenet poster
 
Posts: 46
Default Mergefield Formatting - Trim function? Word 2000

Not to worry - I have dealt with this using a simple IF statement. However,
if there is a more scientific way, I would be interested to learn it.

Thanks.
Chris

"Chris Stammers" wrote:

Hello,

Is there a way of 'trimming' a field in a merge? I have been supplied a data
file and one of the fields has trailing spaces which are being read as
character spaces. I suspect it is just a case of 'ask the person supplying
the data to correct it' however I just thought I would ask.

Many thanks,
Chris


  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Mergefield Formatting - Trim function? Word 2000

Whether or not leading/trailing white space is stripped depends on the data
source and/or the method that Word uses to connect to it.

There's no "trim" function within the field language to do it, which means
we are left with trying "tricks", such as using { SET mylocalfield {
MERGEFIELD myfield } } and so on. I don't think any of those tricks works in
this case but you can always check.

The only other ways to "adjust" a data source from within a Word mail merge
main document are
a. use Word VBA to issue SQL that explicitly trims specified fields. That
requires that you connect using a method that lets you use an SQL dialect
that can do that (e.g. Jet SQL should, I think, let you use trim() ), but my
guess is that if you are using such a method, white space, or at least space
characters, are likely to be trimmed anyway.
b. use VBA (or another suitable language) and Word MailMerge Events to
strip the data and stuff it into the document before each record is merged.

I don't imagine you had anything quite as difficult as either of those
things in mind, though.

Peter Jamieson
"Chris Stammers" wrote in message
...
Hello,

Is there a way of 'trimming' a field in a merge? I have been supplied a
data
file and one of the fields has trailing spaces which are being read as
character spaces. I suspect it is just a case of 'ask the person supplying
the data to correct it' however I just thought I would ask.

Many thanks,
Chris



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Chris Stammers Chris Stammers is offline
external usenet poster
 
Posts: 46
Default Mergefield Formatting - Trim function? Word 2000

Thanks Peter. I basically just copied the contents of the field into an IF
statement and asked the query to put in the text as it should appear. This
just seemed the quickest and easiest way of doing it.

Thanks for your help.

Regards,
Chris

"Peter Jamieson" wrote:

Whether or not leading/trailing white space is stripped depends on the data
source and/or the method that Word uses to connect to it.

There's no "trim" function within the field language to do it, which means
we are left with trying "tricks", such as using { SET mylocalfield {
MERGEFIELD myfield } } and so on. I don't think any of those tricks works in
this case but you can always check.

The only other ways to "adjust" a data source from within a Word mail merge
main document are
a. use Word VBA to issue SQL that explicitly trims specified fields. That
requires that you connect using a method that lets you use an SQL dialect
that can do that (e.g. Jet SQL should, I think, let you use trim() ), but my
guess is that if you are using such a method, white space, or at least space
characters, are likely to be trimmed anyway.
b. use VBA (or another suitable language) and Word MailMerge Events to
strip the data and stuff it into the document before each record is merged.

I don't imagine you had anything quite as difficult as either of those
things in mind, though.

Peter Jamieson
"Chris Stammers" wrote in message
...
Hello,

Is there a way of 'trimming' a field in a merge? I have been supplied a
data
file and one of the fields has trailing spaces which are being read as
character spaces. I suspect it is just a case of 'ask the person supplying
the data to correct it' however I just thought I would ask.

Many thanks,
Chris




  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
peterk peterk is offline
external usenet poster
 
Posts: 7
Default Mergefield Formatting - Trim function? Word 2000

Hi Chris,
I too have the same problem and I'm not sure how to fix it. Can you take a
moment to lay out the step by step details of what you did?

thanks,
Peter.

"Chris Stammers" wrote:

Thanks Peter. I basically just copied the contents of the field into an IF
statement and asked the query to put in the text as it should appear. This
just seemed the quickest and easiest way of doing it.

Thanks for your help.

Regards,
Chris

"Peter Jamieson" wrote:

Whether or not leading/trailing white space is stripped depends on the data
source and/or the method that Word uses to connect to it.

There's no "trim" function within the field language to do it, which means
we are left with trying "tricks", such as using { SET mylocalfield {
MERGEFIELD myfield } } and so on. I don't think any of those tricks works in
this case but you can always check.

The only other ways to "adjust" a data source from within a Word mail merge
main document are
a. use Word VBA to issue SQL that explicitly trims specified fields. That
requires that you connect using a method that lets you use an SQL dialect
that can do that (e.g. Jet SQL should, I think, let you use trim() ), but my
guess is that if you are using such a method, white space, or at least space
characters, are likely to be trimmed anyway.
b. use VBA (or another suitable language) and Word MailMerge Events to
strip the data and stuff it into the document before each record is merged.

I don't imagine you had anything quite as difficult as either of those
things in mind, though.

Peter Jamieson
"Chris Stammers" wrote in message
...
Hello,

Is there a way of 'trimming' a field in a merge? I have been supplied a
data
file and one of the fields has trailing spaces which are being read as
character spaces. I suspect it is just a case of 'ask the person supplying
the data to correct it' however I just thought I would ask.

Many thanks,
Chris






  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Mergefield Formatting - Trim function? Word 2000

Better if you tell us exactly what you have and what you want it to be.

--
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, originally posted via msnews.microsoft.com

"peterk" wrote in message
...
Hi Chris,
I too have the same problem and I'm not sure how to fix it. Can you take
a
moment to lay out the step by step details of what you did?

thanks,
Peter.

"Chris Stammers" wrote:

Thanks Peter. I basically just copied the contents of the field into an
IF
statement and asked the query to put in the text as it should appear.
This
just seemed the quickest and easiest way of doing it.

Thanks for your help.

Regards,
Chris

"Peter Jamieson" wrote:

Whether or not leading/trailing white space is stripped depends on the
data
source and/or the method that Word uses to connect to it.

There's no "trim" function within the field language to do it, which
means
we are left with trying "tricks", such as using { SET mylocalfield {
MERGEFIELD myfield } } and so on. I don't think any of those tricks
works in
this case but you can always check.

The only other ways to "adjust" a data source from within a Word mail
merge
main document are
a. use Word VBA to issue SQL that explicitly trims specified fields.
That
requires that you connect using a method that lets you use an SQL
dialect
that can do that (e.g. Jet SQL should, I think, let you use trim() ),
but my
guess is that if you are using such a method, white space, or at least
space
characters, are likely to be trimmed anyway.
b. use VBA (or another suitable language) and Word MailMerge Events to
strip the data and stuff it into the document before each record is
merged.

I don't imagine you had anything quite as difficult as either of those
things in mind, though.

Peter Jamieson
"Chris Stammers" wrote in
message
...
Hello,

Is there a way of 'trimming' a field in a merge? I have been supplied
a
data
file and one of the fields has trailing spaces which are being read
as
character spaces. I suspect it is just a case of 'ask the person
supplying
the data to correct it' however I just thought I would ask.

Many thanks,
Chris




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
How do I trim input fields in Word 97 mail merge Brett1958 Mailmerge 1 September 15th 06 06:25 PM
Mergefield formatting codes seem to combine digits in numeric data [email protected] Mailmerge 5 March 27th 06 04:34 PM
Fraction formatting for MERGEFIELD David Hall Mailmerge 1 December 27th 05 02:21 PM
How advanced is the "replace" function in Word 2000? Ted Shoemaker Formatting Long Documents 6 July 9th 05 02:17 PM
MergeField Formatting PeterM Microsoft Word Help 2 January 15th 05 07:17 PM


All times are GMT +1. The time now is 11:00 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"