Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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 | |
|
|
![]() |
||||
Thread | Forum | |||
How do I trim input fields in Word 97 mail merge | Mailmerge | |||
Mergefield formatting codes seem to combine digits in numeric data | Mailmerge | |||
Fraction formatting for MERGEFIELD | Mailmerge | |||
How advanced is the "replace" function in Word 2000? | Formatting Long Documents | |||
MergeField Formatting | Microsoft Word Help |