Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Birthdays/Anniversaries

290 views
Skip to first unread message

wiersma7

unread,
Sep 12, 2005, 10:41:03 AM9/12/05
to
Is there any way to calculate the age of my clients and show the results in
the Calendar? For example: Thomas's 24 birthday
--
jkw

Josh

unread,
Sep 12, 2005, 3:52:06 PM9/12/05
to
You can create a custom field which calculates a value using "datediff"
function.

First, enter design mode on the form. On tab p.2, rename to "Age". Add two
new fields, "Age" and "Birthday". The Age field is a number, the birthday
field is a date. On the Age field, go to the Value tab on the Properties.
Under Initial Value, check "set initial value of this field to:" and add the
following code:

Datediff("yyyy",[Birthday],Now)

Run the form. When you add the contact's birthday to the Birthday field,
his age appears in the age field. Publish the form, and you are all set.

kj

unread,
Sep 13, 2005, 1:41:21 AM9/13/05
to
Gentle with us amateur and non programmers, Josh!

I've managed the form design and even publishing to the organization forms
library, but I have two issues;

How can I apply this form to existing contacts?

The "age" calculated by the formula is the age at this years 'birthday", not
necessarily the current age.
i.e., if the contacts 30th birthday will be in October, the formula
currently displays age 30 today. Can the formula be changed to consider
months and days,not just years?

--
/kj
"Josh" <Jo...@discussions.microsoft.com> wrote in message
news:95FAB1E2-C340-4B2A...@microsoft.com...

Joshua Heard

unread,
Sep 13, 2005, 3:44:37 PM9/13/05
to
Research the datediff function on MSDN. You will have to build a more
complicated expression for the field value to accomplish this. Datediff can
use year, month, day, or other interval to calculate the time intervals.
Then use another function to format the date. You might want to consider
writing a script instead. A script could automatically create the calendar
item which the original poster seemed to want.

To publish to existing contacts, there is a way, but I can't remember.
There is a word document that contains a script that someone made. It is
either on slipstick.com or MSDN. It gets complicated using form definitions
and such.


"kj" <k...@nowhere.com> wrote in message
news:OdmSIXCu...@TK2MSFTNGP09.phx.gbl...

kj

unread,
Sep 13, 2005, 3:54:47 PM9/13/05
to
Not as simple as adding mm,dd to yyyy part of;

Datediff("yyyy",[Birthday],Now)
eh?

It figures. But you've spurred my interest, so I will go poke around MSDN
despite it all too frequently giving me a headache. ;-)

Thanks.

--
/kj
"Joshua Heard" <jhe...@nospammsn.com> wrote in message
news:F_FVe.7420$w46....@tornado.texas.rr.com...

Sue Mosher [MVP-Outlook]

unread,
Sep 13, 2005, 4:17:16 PM9/13/05
to
DateDiff has rounding issues. See http://www.slipstick.com/contacts/calcage.htm for a formula that works in almost every case.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"kj" <k...@nowhere.com> wrote in message news:%23htGC0J...@TK2MSFTNGP12.phx.gbl...

kj

unread,
Sep 14, 2005, 11:40:00 AM9/14/05
to
Thanks Sue. That formula works great except for the leap year babies as
noted.

Perhaps you can enlighten me on this. I was expecting this formula and forms
change to save the "age" value to the contact, but it seems to only
calculate the "age" when I create the contact or "run" the form. When I save
and exit the age value is not retained.

Did I do something wrong or are my expectations amiss?

--
/kj
"Sue Mosher [MVP-Outlook]" <sue...@outlookcode.com> wrote in message
news:%23WUy5AK...@TK2MSFTNGP12.phx.gbl...

Sue Mosher [MVP-Outlook]

unread,
Sep 14, 2005, 11:53:49 AM9/14/05
to
You didn't say exactly how you implemented it. If you created a formula field, it should display a value both in the All Fields page and in the folder view.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"kj" <k...@nowhere.com> wrote in message news:eeeIUKUu...@TK2MSFTNGP09.phx.gbl...


> Thanks Sue. That formula works great except for the leap year babies as
> noted.
>
> Perhaps you can enlighten me on this. I was expecting this formula and forms
> change to save the "age" value to the contact, but it seems to only
> calculate the "age" when I create the contact or "run" the form. When I save
> and exit the age value is not retained.
>
> Did I do something wrong or are my expectations amiss?
>
> --
> /kj
> "Sue Mosher [MVP-Outlook]" <sue...@outlookcode.com> wrote in message
> news:%23WUy5AK...@TK2MSFTNGP12.phx.gbl...
> DateDiff has rounding issues. See
> http://www.slipstick.com/contacts/calcage.htm for a formula that works in
> almost every case.
>>>>>

kj

unread,
Sep 14, 2005, 12:32:47 PM9/14/05
to
I tried to follow the guidance from Josh's earlier post.

When I create a new contact and enter the bday, the age field is calculated
and displays the correct value. But when I save the contact and later reopen
it the "age" field while still 'defined' has no value. The Bday field
remains populated. So, it seems the age field is being calculated but not
saved. Does that make sense?

(The age field does show in the custom form and "all fields" but has no
value in either after saving)
/kj
=======


You can create a custom field which calculates a value using "datediff"
function.

First, enter design mode on the form. On tab p.2, rename to "Age". Add two
new fields, "Age" and "Birthday". The Age field is a number, the birthday
field is a date. On the Age field, go to the Value tab on the Properties.
Under Initial Value, check "set initial value of this field to:" and add the
following code:

Datediff("yyyy",[Birthday],Now)

Run the form. When you add the contact's birthday to the Birthday field,
his age appears in the age field. Publish the form, and you are all set.

======

--
/kj
"Sue Mosher [MVP-Outlook]" <sue...@outlookcode.com> wrote in message

news:eMX1qSUu...@TK2MSFTNGP12.phx.gbl...

Sue Mosher [MVP-Outlook]

unread,
Sep 14, 2005, 2:29:47 PM9/14/05
to
I don't have Josh's earlier post handy, so I don't know how you're implementing the age field.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"kj" <k...@nowhere.com> wrote in message news:eXhC1nUu...@TK2MSFTNGP10.phx.gbl...

kj

unread,
Sep 14, 2005, 2:43:53 PM9/14/05
to
Sorry, I included it below;

> =======
> You can create a custom field which calculates a value using "datediff"
> function.
>
> First, enter design mode on the form. On tab p.2, rename to "Age". Add
> two
> new fields, "Age" and "Birthday". The Age field is a number, the birthday
> field is a date. On the Age field, go to the Value tab on the Properties.
> Under Initial Value, check "set initial value of this field to:" and add
> the
> following code:
>
> Datediff("yyyy",[Birthday],Now)
>
> Run the form. When you add the contact's birthday to the Birthday field,
> his age appears in the age field. Publish the form, and you are all set.
> ======

--
/kj
"Sue Mosher [MVP-Outlook]" <sue...@outlookcode.com> wrote in message

news:eF7ZusVu...@TK2MSFTNGP15.phx.gbl...

Sue Mosher [MVP-Outlook]

unread,
Sep 14, 2005, 3:48:16 PM9/14/05
to
So what exactly did you do? Did you publish the form and then create new contacts from the published form?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"kj" <k...@nowhere.com> wrote in message news:%235lQExV...@TK2MSFTNGP14.phx.gbl...


> Sorry, I included it below;
>
>> =======
>> You can create a custom field which calculates a value using "datediff"
>> function.
>>
>> First, enter design mode on the form. On tab p.2, rename to "Age". Add
>> two
>> new fields, "Age" and "Birthday". The Age field is a number, the birthday
>> field is a date. On the Age field, go to the Value tab on the Properties.
>> Under Initial Value, check "set initial value of this field to:" and add
>> the
>> following code:
>>
>> Datediff("yyyy",[Birthday],Now)
>>
>> Run the form. When you add the contact's birthday to the Birthday field,
>> his age appears in the age field. Publish the form, and you are all set.
>> ======
>
> --
> /kj
> "Sue Mosher [MVP-Outlook]" <sue...@outlookcode.com> wrote in message
> news:eF7ZusVu...@TK2MSFTNGP15.phx.gbl...
> I don't have Josh's earlier post handy, so I don't know how you're
> implementing the age field.

>

kj

unread,
Sep 14, 2005, 5:29:10 PM9/14/05
to
Yes. Published the form and set the folder to use the new form when posting.

Open / close Outlook (just to be sure), create a new contact, enter the
birthday, and the Age field shows the correct value. Save and close the new
contact. Open the contact again. The birthday is there, but the age field is
blank.

I had to do something wrong in the process, but I don't know what. I'll go
over it some again, not quite so late at night.

--
/kj
"Sue Mosher [MVP-Outlook]" <sue...@outlookcode.com> wrote in message

news:uy2RPXW...@tk2msftngp13.phx.gbl...

Joshua Heard

unread,
Sep 18, 2005, 8:22:33 PM9/18/05
to
In design mode, look at the field calculation so that "calculate this field
automatically" is checked. "calculate this field when form is created" is
strangely the default.

0 new messages