A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

formatting mailmerge field



 
 
Thread Tools Display Modes
  #1  
Old April 20th, 2005, 10:15 AM
Edoardo Benussi [MVP]
external usenet poster
 
Posts: n/a
Default formatting mailmerge field

Hi all,

I have a word document with mailmerge.
The data source is a msquery through system dsn (odbc)
and data are stored in sql server.

The problem is date format:

with
{MAILMERGE MYDATE}
i see
31/12/2004 0.00.00

with
{MAILMERGE MYDATE \@ "dd/MM/yyyy" }
i see
20/04/2005
that is today.

There is a solution ?
TIA

sorry for my poor english ;-)

--
Edoardo Benussi -
Microsoft® MVP - Windows Server Networking
http://mvp.support.microsoft.com


  #2  
Old April 20th, 2005, 10:35 AM
Peter Jamieson
external usenet poster
 
Posts: n/a
Default

Is that

{ MERGEFIELD MYDATE \@ "dd/MM/yyyy" }

?

Peter Jamieson
"Edoardo Benussi [MVP]" wrote in message
...
Hi all,

I have a word document with mailmerge.
The data source is a msquery through system dsn (odbc)
and data are stored in sql server.

The problem is date format:

with
{MAILMERGE MYDATE}
i see
31/12/2004 0.00.00

with
{MAILMERGE MYDATE \@ "dd/MM/yyyy" }
i see
20/04/2005
that is today.

There is a solution ?
TIA

sorry for my poor english ;-)

--
Edoardo Benussi -
Microsoft® MVP - Windows Server Networking
http://mvp.support.microsoft.com



  #3  
Old April 20th, 2005, 10:51 AM
Edoardo Benussi [MVP]
external usenet poster
 
Posts: n/a
Default

Peter Jamieson wrote:
Is that

{ MERGEFIELD MYDATE \@ "dd/MM/yyyy" }

?

[cut]

Sorry Peter,
I have made an error in writing.
you have to read "MERGEFIELD" instead of "MAILMERGE"
in my prevous post.
tnx

--
Edoardo Benussi -
Microsoft® MVP - Windows Server Networking
http://mvp.support.microsoft.com


  #4  
Old April 20th, 2005, 07:29 PM
Peter Jamieson
external usenet poster
 
Posts: n/a
Default

I have tried to replicate this problem using an SQL server source but have
not been able to do so.

If you do something like

{ SET date2 "{ MERGEFIELD MYDATE }" }

then

{ REF date2 \@ "dd/MM/yyyy" }

what happens?

or even

{ SET date2 "{ QUOTE { MERGEFIELD MYDATE }" }" }

?

Peter Jamieson

"Edoardo Benussi [MVP]" wrote in message
...
Peter Jamieson wrote:
Is that

{ MERGEFIELD MYDATE \@ "dd/MM/yyyy" }

?

[cut]

Sorry Peter,
I have made an error in writing.
you have to read "MERGEFIELD" instead of "MAILMERGE"
in my prevous post.
tnx

--
Edoardo Benussi -
Microsoft® MVP - Windows Server Networking
http://mvp.support.microsoft.com



  #5  
Old April 21st, 2005, 09:30 AM
Edoardo Benussi [MVP]
external usenet poster
 
Posts: n/a
Default

Peter Jamieson wrote:
I have tried to replicate this problem using an SQL server source but
have not been able to do so.

If you do something like

{ SET date2 "{ MERGEFIELD MYDATE }" }

then

{ REF date2 \@ "dd/MM/yyyy" }

what happens?

or even

{ SET date2 "{ QUOTE { MERGEFIELD MYDATE }" }" }

?

[cut]

Thanks Peter,
now I try.

I have made more tests and
seems to me that the problem is as msquery read an datetime field
in sql server.

I'll write the solution if there is one.

Regards.

--
Edoardo Benussi -
Microsoft® MVP - Windows Server
http://mvp.support.microsoft.com


  #6  
Old April 21st, 2005, 10:16 AM
Peter Jamieson
external usenet poster
 
Posts: n/a
Default

OK, some more info that may help you:
a. when you use MS Query to set up a merge data source, it is really only
used to generate the SQL Query that Word uses to get the data. After you
have set up the merge, Word does not use MS Query to get the data (unless
you are connecting to a .dqy that you have saved from MS Query, in which
case things are different).
b. you can inspect the value of
ActiveDocument.MailMerge.DataSource.QueryString to see what SQL Word is
issuing. However, in Word 2002 you may not be able to do that - in that case
you can save your document as HTML format, open the HTML file using e.g.
Notepad, and look for the block of MailMerge information near the top.
c. (Probably not relevant) By the time the field format switches operate on
the data, all the data is in /text/ format (in other words, as far as I
know, the switches are not working with the underlying ISO datatime format,
they are working with the text string you see when you just use { MERGEFIELD
MYDATE }
d. If you are using either Word 2002/2003 yu can always try the OLEDB route
instead...

Peter Jamieson

"Edoardo Benussi [MVP]" wrote in message
...
Peter Jamieson wrote:
I have tried to replicate this problem using an SQL server source but
have not been able to do so.

If you do something like

{ SET date2 "{ MERGEFIELD MYDATE }" }

then

{ REF date2 \@ "dd/MM/yyyy" }

what happens?

or even

{ SET date2 "{ QUOTE { MERGEFIELD MYDATE }" }" }

?

[cut]

Thanks Peter,
now I try.

I have made more tests and
seems to me that the problem is as msquery read an datetime field
in sql server.

I'll write the solution if there is one.

Regards.

--
Edoardo Benussi -
Microsoft® MVP - Windows Server
http://mvp.support.microsoft.com



  #7  
Old April 21st, 2005, 10:28 AM
Edoardo Benussi [MVP]
external usenet poster
 
Posts: n/a
Default

Peter Jamieson wrote:
[cut]
c. (Probably not relevant) By the time the field format switches
operate on the data, all the data is in /text/ format (in other
words, as far as I know, the switches are not working with the
underlying ISO datatime format, they are working with the text string
you see when you just use { MERGEFIELD MYDATE }

[cut]

goal!
i have modified the "select" instruction in msquery
from
select mydate from ...
in
select cast(mydate as char(20)) from ...

and
{ MERGEFIELD MYDATE \@ "dd/MM/yyyy"}
work fine.
tnx.

Bye.

--
Edoardo Benussi -
Microsoft® MVP - Windows Server
http://mvp.support.microsoft.com


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Form Field Formatting Leslie General Discussion 3 June 14th, 2005 03:06 PM
text field formatting dave Using Forms 1 October 29th, 2004 07:50 AM
ASK Field Behavior Greg Mailmerge 9 July 2nd, 2004 02:44 PM
Formatting in Word Mail Merge Field Marlin Mailmerge 3 May 12th, 2004 05:15 AM
mailmerge field moving down a line Hcoms Mailmerge 1 April 30th, 2004 06:39 PM


All times are GMT +1. The time now is 10:00 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.