MS Office Forum / Outlook / Calendaring / September 2005
Birthdays/Anniversaries
|
|
Thread rating:  |
wiersma7 - 12 Sep 2005 15:41 GMT Is there any way to calculate the age of my clients and show the results in the Calendar? For example: Thomas's 24 birthday
 Signature jkw
Josh - 12 Sep 2005 20:52 GMT 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.
> Is there any way to calculate the age of my clients and show the results in > the Calendar? For example: Thomas's 24 birthday kj - 13 Sep 2005 06:41 GMT 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?
 Signature /kj
> You can create a custom field which calculates a value using "datediff" > function. [quoted text clipped - 15 lines] >> in >> the Calendar? For example: Thomas's 24 birthday Joshua Heard - 13 Sep 2005 20:44 GMT 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.
> Gentle with us amateur and non programmers, Josh! > [quoted text clipped - 30 lines] >>> in >>> the Calendar? For example: Thomas's 24 birthday kj - 13 Sep 2005 20:54 GMT 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.
 Signature /kj
> Research the datediff function on MSDN. You will have to build a more > complicated expression for the field value to accomplish this. Datediff [quoted text clipped - 44 lines] >>>> results in >>>> the Calendar? For example: Thomas's 24 birthday Sue Mosher [MVP-Outlook] - 13 Sep 2005 21:17 GMT DateDiff has rounding issues. See http://www.slipstick.com/contacts/calcage.htm for a formula that works in almost every case.
 Signature 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
> Not as simple as adding mm,dd to yyyy part of; > Datediff("yyyy",[Birthday],Now) [quoted text clipped - 53 lines] >>>>> results in >>>>> the Calendar? For example: Thomas's 24 birthday kj - 14 Sep 2005 16:40 GMT 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?
 Signature /kj
DateDiff has rounding issues. See http://www.slipstick.com/contacts/calcage.htm for a formula that works in almost every case.
 Signature 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
> Not as simple as adding mm,dd to yyyy part of; > Datediff("yyyy",[Birthday],Now) [quoted text clipped - 58 lines] >>>>> results in >>>>> the Calendar? For example: Thomas's 24 birthday Sue Mosher [MVP-Outlook] - 14 Sep 2005 16:53 GMT 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.
 Signature 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
> Thanks Sue. That formula works great except for the leap year babies as > noted. [quoted text clipped - 15 lines] >>>>>> results in >>>>>> the Calendar? For example: Thomas's 24 birthday kj - 14 Sep 2005 17:32 GMT 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. ======
 Signature /kj
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.
 Signature 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
> Thanks Sue. That formula works great except for the leap year babies as > noted. [quoted text clipped - 17 lines] >>>>>> results in >>>>>> the Calendar? For example: Thomas's 24 birthday Sue Mosher [MVP-Outlook] - 14 Sep 2005 19:29 GMT I don't have Josh's earlier post handy, so I don't know how you're implementing the age field.
 Signature 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
>I tried to follow the guidance from Josh's earlier post. > [quoted text clipped - 47 lines] >>>>>>> results in >>>>>>> the Calendar? For example: Thomas's 24 birthday kj - 14 Sep 2005 19:43 GMT Sorry, I included it below;
> ======= > You can create a custom field which calculates a value using "datediff" [quoted text clipped - 13 lines] > his age appears in the age field. Publish the form, and you are all set. > ======
 Signature /kj
I don't have Josh's earlier post handy, so I don't know how you're implementing the age field.
 Signature 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
>I tried to follow the guidance from Josh's earlier post. > [quoted text clipped - 50 lines] >>>>>>> results in >>>>>>> the Calendar? For example: Thomas's 24 birthday Sue Mosher [MVP-Outlook] - 14 Sep 2005 20:48 GMT So what exactly did you do? Did you publish the form and then create new contacts from the published form?
 Signature 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
> Sorry, I included it below; > [quoted text clipped - 16 lines] > I don't have Josh's earlier post handy, so I don't know how you're > implementing the age field.
>>I tried to follow the guidance from Josh's earlier post. >> [quoted text clipped - 49 lines] >>>>>>>> results in >>>>>>>> the Calendar? For example: Thomas's 24 birthday kj - 14 Sep 2005 22:29 GMT 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.
 Signature /kj
So what exactly did you do? Did you publish the form and then create new contacts from the published form?
 Signature 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
> Sorry, I included it below; > [quoted text clipped - 20 lines] > I don't have Josh's earlier post handy, so I don't know how you're > implementing the age field.
> "kj" <kj@nowhere.com> wrote in message > news:eXhC1nUuFHA.1168@TK2MSFTNGP10.phx.gbl... [quoted text clipped - 53 lines] >>>>>>>> results in >>>>>>>> the Calendar? For example: Thomas's 24 birthday Joshua Heard - 19 Sep 2005 01:22 GMT 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.
|
|
|