Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / July 2007

Tip: Looking for answers? Try searching our database.

Mergefield Formatting - Trim function? Word 2000

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Stammers - 23 Jul 2007 17:02 GMT
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
Chris Stammers - 23 Jul 2007 17:08 GMT
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

> Hello,
>
[quoted text clipped - 5 lines]
> Many thanks,
> Chris
Peter Jamieson - 23 Jul 2007 18:15 GMT
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
> Hello,
>
[quoted text clipped - 6 lines]
> Many thanks,
> Chris
Chris Stammers - 24 Jul 2007 09:44 GMT
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

> 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.
[quoted text clipped - 28 lines]
> > Many thanks,
> > Chris
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.