#1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Chris Stammers Chris Stammers is offline
external usenet poster
 
Posts: 46
Default Document Date

Hello,

I am using Word 2002 and I have a problem with the { DATE } field. Our data
source is an AS400 platform that doesn't contain the date a record was
created therefore I have been using the following: { DATE \@ "d" \*ordinal }
{ DATE \@ "MMMM yyyy }. This is OK however we have an automatic scanning
facility which is used to recall letters if a customer wants a copy. This has
to have the original date the letter was produced and unfortunately, the
above field will always show the current days date. Is there a field switch I
can use to hardcode the date the letters are generated through the merge? I
have tried CREATEDATE and SAVEDATE; CREATEDATE only ever returns the date the
document was created (obviously, perhaps). SAVEDATE would be prone to
changing if something in the document changes after it has been opened. Any
suggestions?

Thanks,
Chris
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Document Date

I would have thought that the date on which the document was created as
results from the use of the CREATEDATE field would be the date that you want
on the letter. If for some reason that is not, the you would need to unlink
the date field, by selecting it (or the whole document and using
Ctrl=Shift+F9. That of course could be done by the use of some VBA code.

--
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

"Chris Stammers" wrote in message
...
Hello,

I am using Word 2002 and I have a problem with the { DATE } field. Our
data
source is an AS400 platform that doesn't contain the date a record was
created therefore I have been using the following: { DATE \@ "d"
\*ordinal }
{ DATE \@ "MMMM yyyy }. This is OK however we have an automatic scanning
facility which is used to recall letters if a customer wants a copy. This
has
to have the original date the letter was produced and unfortunately, the
above field will always show the current days date. Is there a field
switch I
can use to hardcode the date the letters are generated through the merge?
I
have tried CREATEDATE and SAVEDATE; CREATEDATE only ever returns the date
the
document was created (obviously, perhaps). SAVEDATE would be prone to
changing if something in the document changes after it has been opened.
Any
suggestions?

Thanks,
Chris



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Document Date

If you have a merge document with DATE fields, a merge to a new document
will retain the Date field format and always show the system date (the
problem you currently have).
If you have a merge document with CREATEDATE fields a merge to a new
document will always show the date in the merge document, which is what you
are finding.

To get around this you have three choices.

1. Use SaveAs to save the merge document with the same filename then update
the CREATEDATE fields *before* merging

Sub UpdateCreateDate()
Dim sfName As String
Dim strCodes As String
Dim iFld As Integer
sfName = ActiveDocument.FullName
ActiveDocument.SaveAs FileName:=sfName, FileFormat:=wdFormatDocument
Selection.HomeKey
For iFld = ActiveDocument.Fields.Count To 1 Step -1
With ActiveDocument.Fields(iFld)
If .Type = wdFieldCreateDate Then
.Update
End If
End With
Next iFld
End Sub

OR

2. Keep the DATE fields and run a macro to replace the DATE fields with
CREATEDATE fields in the new document

Sub ChangeFieldContent()
Dim strCodes As String
Dim iFld As Integer
Dim strFind As String
Dim strRepl As String
Selection.HomeKey
For iFld = ActiveDocument.Fields.Count To 1 Step -1
With ActiveDocument.Fields(iFld)
If .Type = wdFieldDate Then
.Code.Text = Replace(UCase(.Code.Text), _
"DATE", "CREATEDATE")
End If
End With
Next iFld
End Sub

OR
3 Unlink the DATE fields in the merged document

Sub UnlinkDateField()
Dim strCodes As String
Dim iFld As Integer
Selection.HomeKey
For iFld = ActiveDocument.Fields.Count To 1 Step -1
With ActiveDocument.Fields(iFld)
If .Type = wdFieldDate Then
.Unlink
End If
End With
Next iFld
End Sub


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Chris Stammers wrote:
Hello,

I am using Word 2002 and I have a problem with the { DATE } field.
Our data source is an AS400 platform that doesn't contain the date a
record was created therefore I have been using the following: { DATE
\@ "d" \*ordinal } { DATE \@ "MMMM yyyy }. This is OK however we have
an automatic scanning facility which is used to recall letters if a
customer wants a copy. This has to have the original date the letter
was produced and unfortunately, the above field will always show the
current days date. Is there a field switch I can use to hardcode the
date the letters are generated through the merge? I have tried
CREATEDATE and SAVEDATE; CREATEDATE only ever returns the date the
document was created (obviously, perhaps). SAVEDATE would be prone to
changing if something in the document changes after it has been
opened. Any suggestions?

Thanks,
Chris



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Document Date

CREATEDATE may do it if you have the right starting point (probably a
template rather than a document).

But if not, when you get data from the AS400, can you specify a SQL Query
that lists a function like today() as one of the fields, in addition to the
fields you're getting from the data source? (I don't know what facilities
are on offer in AS400-land)

If not, you can probably use the technique described in

http://tips.pjmsn.me.uk/t0004.htm

to insert today's date (e.g. using the date() function) and destroy the
field during the merge.

Ideally you would be able to use just one DATABASE field to return the value
formatted exactly as you want it, but since there's a problem whereby Word
now adds a paragraph mark to the result of a DATABASE field, you'll probably
need either
a. two copies of the same DATABASE field (so you can apply the two separate
formats you are using at the moment) or
b.
{ SET today { DATABASE ... } }
then
{ REF today \@ "d" \*ordinal } { REF today \@ "MMMM yyyy }

etc.

Haven't tried that specific approach, and the DATABASE field won't work
inside tables.

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Chris Stammers" wrote in message
...
Hello,

I am using Word 2002 and I have a problem with the { DATE } field. Our
data
source is an AS400 platform that doesn't contain the date a record was
created therefore I have been using the following: { DATE \@ "d"
\*ordinal }
{ DATE \@ "MMMM yyyy }. This is OK however we have an automatic scanning
facility which is used to recall letters if a customer wants a copy. This
has
to have the original date the letter was produced and unfortunately, the
above field will always show the current days date. Is there a field
switch I
can use to hardcode the date the letters are generated through the merge?
I
have tried CREATEDATE and SAVEDATE; CREATEDATE only ever returns the date
the
document was created (obviously, perhaps). SAVEDATE would be prone to
changing if something in the document changes after it has been opened.
Any
suggestions?

Thanks,
Chris


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
Is there a date field that will give the date a document was merge Terri Mailmerge 4 October 18th 07 06:50 AM
How to keep original date on document, do not update date on docu frustrated Mailmerge 4 October 25th 06 09:15 PM
Word Document saved with date later retrieved with current date rostrich Microsoft Word Help 1 October 6th 05 06:30 PM
Can a date be generated based on another date in the document mfelps2 Microsoft Word Help 5 May 18th 05 07:01 PM
How do i update a word document date field with a future date al Microsoft Word Help 2 December 6th 04 09:41 AM


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