PC Review


Reply
Thread Tools Rate Thread

calculate in field with date

 
 
Chey
Guest
Posts: n/a
 
      10th Jan 2008
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 With Quote
 
 
 
 
Tony Jollans
Guest
Posts: n/a
 
      10th Jan 2008
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" <(E-Mail Removed)> wrote in message
news:E233C7B5-A995-4A47-A53E-(E-Mail Removed)...
>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 With Quote
 
Tony Jollans
Guest
Posts: n/a
 
      10th Jan 2008
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
news:%(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:E233C7B5-A995-4A47-A53E-(E-Mail Removed)...
>>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 With Quote
 
Chey
Guest
Posts: n/a
 
      10th Jan 2008
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
> news:%(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > news:E233C7B5-A995-4A47-A53E-(E-Mail Removed)...
> >>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 With Quote
 
Tony Jollans
Guest
Posts: n/a
 
      10th Jan 2008
See http://www.gmayor.com/insert_a_date_...than_today.htm

--
Enjoy,
Tony

"Chey" <(E-Mail Removed)> wrote in message
news:5C2869D9-1B35-4203-9300-(E-Mail Removed)...
>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
>> news:%(E-Mail Removed)...
>> > 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" <(E-Mail Removed)> wrote in message
>> > news:E233C7B5-A995-4A47-A53E-(E-Mail Removed)...
>> >>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 With Quote
 
Peter Jamieson
Guest
Posts: n/a
 
      10th Jan 2008
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" <(E-Mail Removed)> wrote in message
news:5C2869D9-1B35-4203-9300-(E-Mail Removed)...
>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
>> news:%(E-Mail Removed)...
>> > 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" <(E-Mail Removed)> wrote in message
>> > news:E233C7B5-A995-4A47-A53E-(E-Mail Removed)...
>> >>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 With Quote
 
Graham Mayor
Guest
Posts: n/a
 
      11th Jan 2008
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-(mm<bm)-(mm=bm)*(dd<bd) \# 0}}
{Set Months{=MOD(12+mm-bm-(dd<bd),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
>> news:%(E-Mail Removed)...
>>> 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" <(E-Mail Removed)> wrote in message
>>> news:E233C7B5-A995-4A47-A53E-(E-Mail Removed)...
>>>> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need a date field to calculate according to another Corey Keller Microsoft Access 3 2nd Jan 2008 12:19 AM
Can anyone calculate age next birthday from date field? =?Utf-8?B?U2hlaWxh?= Microsoft Excel Worksheet Functions 1 26th Feb 2006 05:14 PM
Automatically Calculate Date field =?Utf-8?B?SmlsbA==?= Microsoft Outlook Form Programming 1 5th May 2005 01:12 PM
Calculate seasons from a date field Michael Winn via AccessMonster.com Microsoft Access Queries 3 7th Jan 2005 08:00 PM
Calculate Date field Connie Microsoft Access 4 29th Jul 2003 04:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:35 PM.