View Single Post
  #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