Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Thicklizzie Thicklizzie is offline
external usenet poster
 
Posts: 2
Default suppressing part of a text field in a merged document

I am mail merging from an Access database and one of the fields contains full
names (e.g. Mary Smith, Michael Jones, etc.) I want the merged document to
show just the first name (e.g. Dear Mary or Dear Michael).

I cannot change how the information is entered in the Access database and
this information is already change by a "Mid([ReferalName],11,55)" in the
query.


  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default suppressing part of a text field in a merged document

Hi Thicklizzie,

It isn't possible to suppress part of a maergefield. Your database really should have the surnames and given names in separate
fields.

--
Cheers
macropod
[Microsoft MVP - Word]


"Thicklizzie" wrote in message ...
I am mail merging from an Access database and one of the fields contains full
names (e.g. Mary Smith, Michael Jones, etc.) I want the merged document to
show just the first name (e.g. Dear Mary or Dear Michael).

I cannot change how the information is entered in the Access database and
this information is already change by a "Mid([ReferalName],11,55)" in the
query.



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default suppressing part of a text field in a merged document


I cannot change how the information is entered in the Access database
and this information is already change by a "Mid([ReferalName],11,55)"
in the query.


If you can use Word VBA, you may be able to create the query you need
even if you cannot change the Access database that you need to use.

For example, suppose your merge currently uses an Access query called
myquery as the data source, and myquery is defined as

SELECT fielda, mid([ReferalName],11,55) As rname from mytable

Suppose you actually need the part of "rname" up to the first space, if any.

Then you would need something like

SELECT fielda, left(rname & ' ',instr(1,rname & ' ',' ')-1) as myrname
from myquery

(In other words, you can use SQL queries to query a query, not just a table)

To do that, you would need to run VBA such as

Activedocument.MailMerge.OpenDataSource _
Name:="the full pathname of your Access .mdb file", _
SQLStatement:= _
" SELECT" & _
" fielda," & _
" left(rname & ' '," & _
" instr(1,rname & ' ',' ')-1)" & _
" as myrname" & _
" FROM myquery"

(You should only need to run this once for the query to be set up as
your data source, and there may well be complications if for example
users of the document try to change the query using the facilities in
Edit Recipients )

I can't guarantee that that will work in all versions of Word but it
functions in Word 2003

Peter Jamieson

http://tips.pjmsn.me.uk

Thicklizzie wrote:
I am mail merging from an Access database and one of the fields contains full
names (e.g. Mary Smith, Michael Jones, etc.) I want the merged document to
show just the first name (e.g. Dear Mary or Dear Michael).

I cannot change how the information is entered in the Access database and
this information is already change by a "Mid([ReferalName],11,55)" in the
query.


  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Thicklizzie Thicklizzie is offline
external usenet poster
 
Posts: 2
Default suppressing part of a text field in a merged document

Thank you for your help. Unfortunately I don't know VBA or SQL at all and
would probably crash my whole computer if I tried to do any of that stuff.
But thank you so much for coming up with, I am sure, a very workable solution.

"Peter Jamieson" wrote:


I cannot change how the information is entered in the Access database
and this information is already change by a "Mid([ReferalName],11,55)"
in the query.


If you can use Word VBA, you may be able to create the query you need
even if you cannot change the Access database that you need to use.

For example, suppose your merge currently uses an Access query called
myquery as the data source, and myquery is defined as

SELECT fielda, mid([ReferalName],11,55) As rname from mytable

Suppose you actually need the part of "rname" up to the first space, if any.

Then you would need something like

SELECT fielda, left(rname & ' ',instr(1,rname & ' ',' ')-1) as myrname
from myquery

(In other words, you can use SQL queries to query a query, not just a table)

To do that, you would need to run VBA such as

Activedocument.MailMerge.OpenDataSource _
Name:="the full pathname of your Access .mdb file", _
SQLStatement:= _
" SELECT" & _
" fielda," & _
" left(rname & ' '," & _
" instr(1,rname & ' ',' ')-1)" & _
" as myrname" & _
" FROM myquery"

(You should only need to run this once for the query to be set up as
your data source, and there may well be complications if for example
users of the document try to change the query using the facilities in
Edit Recipients )

I can't guarantee that that will work in all versions of Word but it
functions in Word 2003

Peter Jamieson

http://tips.pjmsn.me.uk

Thicklizzie wrote:
I am mail merging from an Access database and one of the fields contains full
names (e.g. Mary Smith, Michael Jones, etc.) I want the merged document to
show just the first name (e.g. Dear Mary or Dear Michael).

I cannot change how the information is entered in the Access database and
this information is already change by a "Mid([ReferalName],11,55)" in the
query.



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
Only part of data in Excel field is merged into Word Golfergirl Mailmerge 2 December 10th 08 04:38 PM
Only displaying part of a merged field/formatting parts of a merge Andy Mailmerge 4 October 23rd 07 12:08 PM
How to create an email from mail merge including a hyperlink, so that the value of a merged field is included as part of the hyperlink URL, not just part of its text. [email protected] Mailmerge 4 August 22nd 07 06:18 PM
How to create an email from mail merge including a hyperlink, so that the value of a merged field is included as part of the hyperlink URL, not just part of its text. [email protected] Mailmerge 0 August 17th 07 03:52 PM
Suppressing the Open Link box to a mail merged document [email protected] Mailmerge 1 April 13th 06 07:49 AM


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