Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Chey Chey is offline
external usenet poster
 
Posts: 13
Default calculate in field with date

I have fields in my form and in text53 you type the date of birth. In
another field I want to subtract the current date by text53 to get the
person's age.
How do I write the formula?

Thanks
Cheyenne
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Tony Jollans Tony Jollans is offline
external usenet poster
 
Posts: 1,308
Default calculate in field with date

You really don't want to know. It is immensely complicated and
incomprehensible to ordinary mortals. MVP macropod has written a document on
the subject but I don't have a handy link. Consider doing the calculations
in a VBA macro, where it is pretty straightforward.

--
Enjoy,
Tony

"Chey" wrote in message
...
I have fields in my form and in text53 you type the date of birth. In
another field I want to subtract the current date by text53 to get the
person's age.
How do I write the formula?

Thanks
Cheyenne


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Tony Jollans Tony Jollans is offline
external usenet poster
 
Posts: 1,308
Default calculate in field with date

Here's a link to macropods document ...

http://www.wopr.com/cgi-bin/w3t/show...?Number=249902

--
Enjoy,
Tony

"Tony Jollans" My forename at my surname dot com wrote in message
...
You really don't want to know. It is immensely complicated and
incomprehensible to ordinary mortals. MVP macropod has written a document
on the subject but I don't have a handy link. Consider doing the
calculations in a VBA macro, where it is pretty straightforward.

--
Enjoy,
Tony

"Chey" wrote in message
...
I have fields in my form and in text53 you type the date of birth. In
another field I want to subtract the current date by text53 to get the
person's age.
How do I write the formula?

Thanks
Cheyenne



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Chey Chey is offline
external usenet poster
 
Posts: 13
Default calculate in field with date

I have been messing with that. However I don't know how to intermigle my
field where I type the date into it.

How do I do it in VBA?

"Tony Jollans" wrote:

Here's a link to macropods document ...

http://www.wopr.com/cgi-bin/w3t/show...?Number=249902

--
Enjoy,
Tony

"Tony Jollans" My forename at my surname dot com wrote in message
...
You really don't want to know. It is immensely complicated and
incomprehensible to ordinary mortals. MVP macropod has written a document
on the subject but I don't have a handy link. Consider doing the
calculations in a VBA macro, where it is pretty straightforward.

--
Enjoy,
Tony

"Chey" wrote in message
...
I have fields in my form and in text53 you type the date of birth. In
another field I want to subtract the current date by text53 to get the
person's age.
How do I write the formula?

Thanks
Cheyenne




  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Tony Jollans Tony Jollans is offline
external usenet poster
 
Posts: 1,308
Default calculate in field with date

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

--
Enjoy,
Tony

"Chey" wrote in message
...
I have been messing with that. However I don't know how to intermigle my
field where I type the date into it.

How do I do it in VBA?

"Tony Jollans" wrote:

Here's a link to macropods document ...

http://www.wopr.com/cgi-bin/w3t/show...?Number=249902

--
Enjoy,
Tony

"Tony Jollans" My forename at my surname dot com wrote in message
...
You really don't want to know. It is immensely complicated and
incomprehensible to ordinary mortals. MVP macropod has written a
document
on the subject but I don't have a handy link. Consider doing the
calculations in a VBA macro, where it is pretty straightforward.

--
Enjoy,
Tony

"Chey" wrote in message
...
I have fields in my form and in text53 you type the date of birth. In
another field I want to subtract the current date by text53 to get the
person's age.
How do I write the formula?

Thanks
Cheyenne






  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default calculate in field with date

If you want, try this (I have no idea if it will work at all, especially
with a set of fields this complex):

I'm assuming you are using a Word "online form" with form fields that look
like { FORMTEXT } when you display field codes (e.g. using Alt-F9).

Let's suppose you start with just two fields. The field you enter your date
into is called "ed" (in the field properties, which you can access by
right-clicking on the field. Make sure you check "calculate on exit" while
you are in there) and you want to display the calculated date in another
field called "cd"

Set up your "cd" field so that it is a calculated field, and temporaily
insert a calculation such as

=ed

(it won't work properly)

When you unprotect the form and display the field codes, you should now see
something like

{ FORMTEXT } { FORMTEXT {=ed } }

Somewhere else in your document, insert the set of field codes you've worked
out from macropod's article. If it isn't all nested inside a single {
QUOTE } field, which if I remember correctly is macropod's usual approach,
add a { QUOTE } field around the outside.

Select that complete set of fields and paste it into the second FORMTEXT
field so that it replaces {=ed}

Protect your form and see what happens.

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

"Chey" wrote in message
...
I have been messing with that. However I don't know how to intermigle my
field where I type the date into it.

How do I do it in VBA?

"Tony Jollans" wrote:

Here's a link to macropods document ...

http://www.wopr.com/cgi-bin/w3t/show...?Number=249902

--
Enjoy,
Tony

"Tony Jollans" My forename at my surname dot com wrote in message
...
You really don't want to know. It is immensely complicated and
incomprehensible to ordinary mortals. MVP macropod has written a
document
on the subject but I don't have a handy link. Consider doing the
calculations in a VBA macro, where it is pretty straightforward.

--
Enjoy,
Tony

"Chey" wrote in message
...
I have fields in my form and in text53 you type the date of birth. In
another field I want to subtract the current date by text53 to get the
person's age.
How do I write the formula?

Thanks
Cheyenne




  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default calculate in field with date

The construction for producing age from a date field is

{QUOTE
{SET by {BirthDate \@ yyyy}}
{SET bm {BirthDate \@ M}}
{SET bd {BirthDate \@ d}}
{SET yy {DATE \@ yyyy}}
{SET mm {DATE \@ M}}
{SET dd {DATE \@ d}}
{SET
md{=IF((mm=2),28+(mm=2)*((MOD(yy,4)=0)+(MOD(yy,400 )=0)-(MOD(yy,100)=0)),31-((mm=4)+(mm=6)+(mm=9)+(mm=11)))}}
{Set Years{=yy-by-(mmbm)-(mm=bm)*(ddbd) \# 0}}
{Set Months{=MOD(12+mm-bm-(ddbd),12) \# 0}}
{Set Days{=MOD(md+dd-bd,md) \# 0}}
"Your age is {Years} Year{IF{Years}= 1 "" s}, {Months} Month{IF{Months}= 1
"" s} and {Days} Day{IF{Days}= 1 "" s}."}

With the field construction displayed (paste it from Macropod's document),
use Replace to change
BirthDate for Text53 (or better still rename Text53 to BirthDate)

--

Graham Mayor - Word MVP

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


Chey wrote:
I have been messing with that. However I don't know how to
intermigle my field where I type the date into it.

How do I do it in VBA?

"Tony Jollans" wrote:

Here's a link to macropods document ...

http://www.wopr.com/cgi-bin/w3t/show...?Number=249902

--
Enjoy,
Tony

"Tony Jollans" My forename at my surname dot com wrote in message
...
You really don't want to know. It is immensely complicated and
incomprehensible to ordinary mortals. MVP macropod has written a
document on the subject but I don't have a handy link. Consider
doing the calculations in a VBA macro, where it is pretty
straightforward.

--
Enjoy,
Tony

"Chey" wrote in message
...
I have fields in my form and in text53 you type the date of birth.
In another field I want to subtract the current date by text53 to
get the person's age.
How do I write the formula?

Thanks
Cheyenne



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 to calculate a Future Date? ToniEPC New Users 1 May 22nd 06 04:11 PM
Can I calculate a merged date field based on today plus # of days Lorraine Tables 5 March 30th 06 09:52 PM
Calculate Age in table from Date of Birth and Current Date (MSWord Bill Tables 6 February 17th 06 05:11 PM
How do I calculate a date from a merge field? Bianca Sergueeva Mailmerge 5 June 28th 05 03:46 PM
Calculate a date from days date KS Microsoft Word Help 2 May 10th 05 12:50 PM


All times are GMT +1. The time now is 02:35 AM.

Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"