开发者

Trimming white space in MS Word + Access mail merge

开发者 https://www.devze.com 2023-04-05 11:25 出处:网络
I am trying to do a mail merge with an Access database, but the output looks like this: Dear JOHNSMITH,

I am trying to do a mail merge with an Access database, but the output looks like this:

Dear JOHN      SMITH,

Is there a way to trim the white space? I have several thousand of these and I dread having to manually delete the whit开发者_Go百科e space on every one of them.

Also, if I could remove the all CAPS and change it to John Smith, that would be awesome.


I would suggest basing your mail merge on a query, and doing the required concatenation and formatting in the query prior to mail merge. Using the following expression in a query will give you a full name in title (or proper) case with one space between first and last names.

FullName: StrConv([FirstName] & " " & [LastName],3)

If you are still having trouble with white space in the name fields you can go further if necessary using the Trim function, and trim both names before concatenating them:

FullName: StrConv(Trim([FirstName]) & " " & Trim([LastName]),3)

Note that if you do something like the above you will only need to use the resulting FullName field on your mail merge form, and it will appear with only the single space between the names as desired.


You can do this in a query and base your mailmerge on that.

StrConv will treat case: http://support.microsoft.com/kb/815282
Trim will work for spaces: http://office.microsoft.com/en-us/access-help/ltrim-rtrim-and-trim-functions-HA001228878.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号