Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Mark Ashley
 
Posts: n/a
Default Insert a future date

This may be a dumb question, but I can't figure out how to get Word (2003) to
insert a future date. For example, insert the date that is 30 days from the
current date.

Thanks for any help. I can't believe the time I've spent trying to figure
this out.
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor
 
Posts: n/a
Default Insert a future date

See http://www.gmayor.com/insert_a_date_...than_today.htm

--

Graham Mayor - Word MVP

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



Mark Ashley wrote:
This may be a dumb question, but I can't figure out how to get Word
(2003) to insert a future date. For example, insert the date that is
30 days from the current date.

Thanks for any help. I can't believe the time I've spent trying to
figure this out.



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Charles Kenyon
 
Posts: n/a
Default Insert a future date

This is more complex than you might imagine, but it can be done. See
http://addbalance.com/word/datefields2.htm for information on the different
kinds of ways to make a date calculation work. It includes links to pages
with fields and an explanation of different macros that can be used instead
of fields.

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Mark Ashley" wrote in message
news
This may be a dumb question, but I can't figure out how to get Word (2003)
to
insert a future date. For example, insert the date that is 30 days from
the
current date.

Thanks for any help. I can't believe the time I've spent trying to figure
this out.


  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Chris Stammers
 
Posts: n/a
Default Insert a future date

Hello,

I am also trying to do this (I need to add 14 days to todays date). I picked
up a long string of code from one of the guys here which works well on its
own however, when used in a mail merge document, the code interferes with the
merge fields and stops them working, so no letters are produced at all. We
are using Word 2000 v9.0. Does anyone have any experience of this? I should
perhaps say that the source data is coming from an AS400 system rather than a
created Excel or Access file.

Thanks.
Regards,
Chris

"Charles Kenyon" wrote:

This is more complex than you might imagine, but it can be done. See
http://addbalance.com/word/datefields2.htm for information on the different
kinds of ways to make a date calculation work. It includes links to pages
with fields and an explanation of different macros that can be used instead
of fields.

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Mark Ashley" wrote in message
news
This may be a dumb question, but I can't figure out how to get Word (2003)
to
insert a future date. For example, insert the date that is 30 days from
the
current date.

Thanks for any help. I can't believe the time I've spent trying to figure
this out.




  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor
 
Posts: n/a
Default Insert a future date

What do you mean by 'interferes'? You have to substitute your mergefields
and switches as appropriate - see
http://www.gmayor.com/insert_a_date_...than_today.htm

--

Graham Mayor - Word MVP

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



Chris Stammers wrote:
Hello,

I am also trying to do this (I need to add 14 days to todays date). I
picked up a long string of code from one of the guys here which works
well on its own however, when used in a mail merge document, the code
interferes with the merge fields and stops them working, so no
letters are produced at all. We are using Word 2000 v9.0. Does anyone
have any experience of this? I should perhaps say that the source
data is coming from an AS400 system rather than a created Excel or
Access file.

Thanks.
Regards,
Chris

"Charles Kenyon" wrote:

This is more complex than you might imagine, but it can be done. See
http://addbalance.com/word/datefields2.htm for information on the
different kinds of ways to make a date calculation work. It includes
links to pages with fields and an explanation of different macros
that can be used instead of fields.

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Mark Ashley" wrote in message
news
This may be a dumb question, but I can't figure out how to get Word
(2003) to
insert a future date. For example, insert the date that is 30 days
from the
current date.

Thanks for any help. I can't believe the time I've spent trying to
figure this out.





  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Chris Stammers
 
Posts: n/a
Default Insert a future date

It stopped the mailmerge working. When we deleted the future date code, the
mailmerge worked with no problems or errors. The mergefields we are using are
pre-determined by our database and although we can use the usual picture
switches - caps/upper etc - we can't modify the data any further. I hope I
haven't missed the point here!

"Graham Mayor" wrote:

What do you mean by 'interferes'? You have to substitute your mergefields
and switches as appropriate - see
http://www.gmayor.com/insert_a_date_...than_today.htm

--

Graham Mayor - Word MVP

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



Chris Stammers wrote:
Hello,

I am also trying to do this (I need to add 14 days to todays date). I
picked up a long string of code from one of the guys here which works
well on its own however, when used in a mail merge document, the code
interferes with the merge fields and stops them working, so no
letters are produced at all. We are using Word 2000 v9.0. Does anyone
have any experience of this? I should perhaps say that the source
data is coming from an AS400 system rather than a created Excel or
Access file.

Thanks.
Regards,
Chris

"Charles Kenyon" wrote:

This is more complex than you might imagine, but it can be done. See
http://addbalance.com/word/datefields2.htm for information on the
different kinds of ways to make a date calculation work. It includes
links to pages with fields and an explanation of different macros
that can be used instead of fields.

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Mark Ashley" wrote in message
news This may be a dumb question, but I can't figure out how to get Word
(2003) to
insert a future date. For example, insert the date that is 30 days
from the
current date.

Thanks for any help. I can't believe the time I've spent trying to
figure this out.




  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor
 
Posts: n/a
Default Insert a future date

The field construction to add 14 days to a mergefield (here Datefield) is

{QUOTE{SET Delay 14}{SET a{=INT((14-{MERGEFIELD DATEFIELD \@ M})/12)}}{SET
b{={MERGEFIELD DATEFIELD \@ yyyy}+4800-a}}{SET c{={MERGEFIELD DATEFIELD \@
M}+12*a-3}}{SET d{MERGEFIELD DATEFIELD \@ d}}{SET
jd{=d+INT((153*c+2)/5)+365*b+INT(b/4)-INT(b/100)+INT(b/400)-32045+Delay}}{SET
e{=INT((4*(jd+32044)+3)/146097)}}{SET f{=jd+32044-INT(146097*e/4)}}{SET
g{=INT((4*f+3)/1461)}}{SET h{=f-INT(1461*g/4)}}{SET
i{=INT((5*h+2)/153)}}{SET dd{=h-INT((153*i+2)/5)+1}}{SET
mm{=i+3-12*INT(i/10)}}{SET yy{=100*e+g-4800+INT(i/10)}}{=dd*10^6+mm*10^4+yy
\# "00'-'00'-'0000"} \@ "dddd, d MMMM yyyy"}

You are asking for trouble if you try to reconstruct that by hand, so
download the sample document via the link on the quoted web page and edit
the sample code

--

Graham Mayor - Word MVP

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



Chris Stammers wrote:
It stopped the mailmerge working. When we deleted the future date
code, the mailmerge worked with no problems or errors. The
mergefields we are using are pre-determined by our database and
although we can use the usual picture switches - caps/upper etc - we
can't modify the data any further. I hope I haven't missed the point
here!

"Graham Mayor" wrote:

What do you mean by 'interferes'? You have to substitute your
mergefields and switches as appropriate - see
http://www.gmayor.com/insert_a_date_...than_today.htm

--

Graham Mayor - Word MVP

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



Chris Stammers wrote:
Hello,

I am also trying to do this (I need to add 14 days to todays date).
I picked up a long string of code from one of the guys here which
works well on its own however, when used in a mail merge document,
the code interferes with the merge fields and stops them working,
so no letters are produced at all. We are using Word 2000 v9.0.
Does anyone have any experience of this? I should perhaps say that
the source data is coming from an AS400 system rather than a
created Excel or Access file.

Thanks.
Regards,
Chris

"Charles Kenyon" wrote:

This is more complex than you might imagine, but it can be done.
See http://addbalance.com/word/datefields2.htm for information on
the different kinds of ways to make a date calculation work. It
includes links to pages with fields and an explanation of
different macros that can be used instead of fields.

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version
of Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Mark Ashley" wrote in
message news This may be a dumb question, but I can't figure out how to get
Word (2003) to
insert a future date. For example, insert the date that is 30
days from the
current date.

Thanks for any help. I can't believe the time I've spent trying
to figure this out.



  #8   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default Insert a future date

I get the impression that the problem could be that the date fields coming
across from the AS400 are not treated as dates by Word. If Word sees the
field "mydate" as a date, then Word's date switches should function, e.g. if
mydate is 13 June 2006, then

{ MERGEFIELD mydate \@YYYY }

should display as 2006,

{ MERGEFIELD mydate \@M }

should display as 6, and so on. This is crucial to the functioning of the
fields Graham describes.

If Word is not treating your AS400 dates as dates, either another approach
is needed or you need to try to get it to do so. I don't know AS400 and
don't have one to experiment with here, but
a. are the dates in something that is obviously a date field on AS400?
b. how are you connecting to the AS400? Do you use an ODBC driver or an
OLEDB provider? Do you know if the AS400 driver/provider implements a
standard dialect of SQL?

Peter Jamieson


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

I am also trying to do this (I need to add 14 days to todays date). I
picked
up a long string of code from one of the guys here which works well on its
own however, when used in a mail merge document, the code interferes with
the
merge fields and stops them working, so no letters are produced at all. We
are using Word 2000 v9.0. Does anyone have any experience of this? I
should
perhaps say that the source data is coming from an AS400 system rather
than a
created Excel or Access file.

Thanks.
Regards,
Chris

"Charles Kenyon" wrote:

This is more complex than you might imagine, but it can be done. See
http://addbalance.com/word/datefields2.htm for information on the
different
kinds of ways to make a date calculation work. It includes links to pages
with fields and an explanation of different macros that can be used
instead
of fields.

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Mark Ashley" wrote in message
news
This may be a dumb question, but I can't figure out how to get Word
(2003)
to
insert a future date. For example, insert the date that is 30 days
from
the
current date.

Thanks for any help. I can't believe the time I've spent trying to
figure
this out.






  #9   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Chris Stammers
 
Posts: n/a
Default Insert a future date

Dear Peter,

I note that you are using a field called MYDATE. The date field that is
being used is { TIME \@ €œdd MMMM yyyy€ }. Could that be making it all fall
over do you think? The letter date isn't being driven from AS400.

Does the 'mydate' function still populate today's date?

Regards,
Chris

"Peter Jamieson" wrote:

I get the impression that the problem could be that the date fields coming
across from the AS400 are not treated as dates by Word. If Word sees the
field "mydate" as a date, then Word's date switches should function, e.g. if
mydate is 13 June 2006, then

{ MERGEFIELD mydate \@YYYY }

should display as 2006,

{ MERGEFIELD mydate \@M }

should display as 6, and so on. This is crucial to the functioning of the
fields Graham describes.

If Word is not treating your AS400 dates as dates, either another approach
is needed or you need to try to get it to do so. I don't know AS400 and
don't have one to experiment with here, but
a. are the dates in something that is obviously a date field on AS400?
b. how are you connecting to the AS400? Do you use an ODBC driver or an
OLEDB provider? Do you know if the AS400 driver/provider implements a
standard dialect of SQL?

Peter Jamieson


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

I am also trying to do this (I need to add 14 days to todays date). I
picked
up a long string of code from one of the guys here which works well on its
own however, when used in a mail merge document, the code interferes with
the
merge fields and stops them working, so no letters are produced at all. We
are using Word 2000 v9.0. Does anyone have any experience of this? I
should
perhaps say that the source data is coming from an AS400 system rather
than a
created Excel or Access file.

Thanks.
Regards,
Chris

"Charles Kenyon" wrote:

This is more complex than you might imagine, but it can be done. See
http://addbalance.com/word/datefields2.htm for information on the
different
kinds of ways to make a date calculation work. It includes links to pages
with fields and an explanation of different macros that can be used
instead
of fields.

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Mark Ashley" wrote in message
news This may be a dumb question, but I can't figure out how to get Word
(2003)
to
insert a future date. For example, insert the date that is 30 days
from
the
current date.

Thanks for any help. I can't believe the time I've spent trying to
figure
this out.






  #10   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default Insert a future date

I note that you are using a field called MYDATE

I was just using "mydate" as a sample name for a date field, to be
substituted by whatever date field name you might have. (cf. Graham's use of
"DATEFIELD"). But you don't have one anyway.

Using TIME instead of the MERGEFIELD DATEFIELD works fine here and allows
the merge, at least on Word 2003 - I haven't been able to check with Word
2000.

Peter Jamieson

"Chris Stammers" wrote in message
...
Dear Peter,

I note that you are using a field called MYDATE. The date field that is
being used is { TIME \@ "dd MMMM yyyy" }. Could that be making it all fall
over do you think? The letter date isn't being driven from AS400.

Does the 'mydate' function still populate today's date?

Regards,
Chris

"Peter Jamieson" wrote:

I get the impression that the problem could be that the date fields
coming
across from the AS400 are not treated as dates by Word. If Word sees the
field "mydate" as a date, then Word's date switches should function, e.g.
if
mydate is 13 June 2006, then

{ MERGEFIELD mydate \@YYYY }

should display as 2006,

{ MERGEFIELD mydate \@M }

should display as 6, and so on. This is crucial to the functioning of the
fields Graham describes.

If Word is not treating your AS400 dates as dates, either another
approach
is needed or you need to try to get it to do so. I don't know AS400 and
don't have one to experiment with here, but
a. are the dates in something that is obviously a date field on AS400?
b. how are you connecting to the AS400? Do you use an ODBC driver or an
OLEDB provider? Do you know if the AS400 driver/provider implements a
standard dialect of SQL?

Peter Jamieson


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

I am also trying to do this (I need to add 14 days to todays date). I
picked
up a long string of code from one of the guys here which works well on
its
own however, when used in a mail merge document, the code interferes
with
the
merge fields and stops them working, so no letters are produced at all.
We
are using Word 2000 v9.0. Does anyone have any experience of this? I
should
perhaps say that the source data is coming from an AS400 system rather
than a
created Excel or Access file.

Thanks.
Regards,
Chris

"Charles Kenyon" wrote:

This is more complex than you might imagine, but it can be done. See
http://addbalance.com/word/datefields2.htm for information on the
different
kinds of ways to make a date calculation work. It includes links to
pages
with fields and an explanation of different macros that can be used
instead
of fields.

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Mark Ashley" wrote in message
news This may be a dumb question, but I can't figure out how to get Word
(2003)
to
insert a future date. For example, insert the date that is 30 days
from
the
current date.

Thanks for any help. I can't believe the time I've spent trying to
figure
this out.










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
How do i insert future date ina word document Codeed Microsoft Word Help 1 October 27th 05 06:50 AM
How to insert future date based on current date plus 14 days John Bakker Microsoft Word Help 1 January 31st 05 09:08 PM
inserting a date field for a future date rm Microsoft Word Help 2 January 10th 05 07:18 PM
insert a future date Tim Wallin Microsoft Word Help 10 December 5th 04 12:25 AM
insert a future date Tim Wallin Microsoft Word Help 3 December 4th 04 04:29 PM


All times are GMT +1. The time now is 06:21 AM.

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"