A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Automatically calculate age from birthdate



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 30th 09, 01:15 AM posted to microsoft.public.outlook.program_forms
Fred Boer[_2_]
external usenet poster
 
Posts: 16
Default Automatically calculate age from birthdate

Hi:

I have a textbox which I want to have filled with the contact person's age,
derived from birthdate using a formula. I have a formula, and have created a
working textbox. If I change the birthdate it fills in the textbox.

But...

I have existing birthdate data for contacts. The textbox does not appear to
respond to existing data. Is there a way to force the calculation when I
move from one contact to another (on menu using up/down arrows), or when I
open the form for a contact who has an existing birthdate?

Thanks!
Fred



  #2  
Old June 30th 09, 01:59 AM posted to microsoft.public.outlook.program_forms
Fred Boer[_2_]
external usenet poster
 
Posts: 16
Default Automatically calculate age from birthdate

I am making some progress. This works:
Item.UserProperties.Find("Age").Value = "Hello"

But this generates a "Type Mismatch" error message:

Item.UserProperties.Find("Age").Value =
IIf([Birthday]"None",DateDiff("yyyy",[Birthday],Date())-IIf(DateDiff("d",CDate(Month([Birthday])
& "/" & Day([Birthday]) & "/" & Year(Date())),Date())0,1,0),"")

Still plugging away...

Thanks!

Fred

Fred Boer" wrote in message
...

Hi:

I have a textbox which I want to have filled with the contact person's
age, derived from birthdate using a formula. I have a formula, and have
created a working textbox. If I change the birthdate it fills in the
textbox.

But...

I have existing birthdate data for contacts. The textbox does not appear
to respond to existing data. Is there a way to force the calculation when
I move from one contact to another (on menu using up/down arrows), or when
I open the form for a contact who has an existing birthdate?

Thanks!
Fred





  #3  
Old June 30th 09, 01:01 PM posted to microsoft.public.outlook.program_forms
Fred Boer[_2_]
external usenet poster
 
Posts: 16
Default Automatically calculate age from birthdate

Hello:

I've learned that the problem is with IIF in VBScript (I thnink!).
Found this code (thanks Sue Mosher):

Public Function IIf(blnExpression, vTrueResult, vFalseResult)
If blnExpression Then
IIf = vTrueResult
Else
IIf = vFalseResult
End If
End Function

and now this expression appears to work:

Item.UserProperties.Find("Age").Value =
IIf([Birthday]"None",DateDiff("yyyy",[Birthday],Date())-IIf(DateDiff("d",CDate(Month([Birthday])
& "/" & Day([Birthday]) & "/" & Year(Date())),Date())0,1,0),"")

Thanks,
Fred

"Fred Boer" wrote in message
...
I am making some progress. This works:
Item.UserProperties.Find("Age").Value = "Hello"

But this generates a "Type Mismatch" error message:

Item.UserProperties.Find("Age").Value =
IIf([Birthday]"None",DateDiff("yyyy",[Birthday],Date())-IIf(DateDiff("d",CDate(Month([Birthday])
& "/" & Day([Birthday]) & "/" & Year(Date())),Date())0,1,0),"")

Still plugging away...

Thanks!

Fred

Fred Boer" wrote in message
...

Hi:

I have a textbox which I want to have filled with the contact person's
age, derived from birthdate using a formula. I have a formula, and have
created a working textbox. If I change the birthdate it fills in the
textbox.

But...

I have existing birthdate data for contacts. The textbox does not appear
to respond to existing data. Is there a way to force the calculation when
I move from one contact to another (on menu using up/down arrows), or
when I open the form for a contact who has an existing birthdate?

Thanks!
Fred







 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
auto calculate age from birthdate in Calendar Arne Outlook - Calandaring 3 February 20th 08 08:59 PM
Can I automatically calculate ages from the birth dates in Contact The Canberran Outlook - Using Contacts 1 June 10th 07 12:56 AM
Calculate meeting timings VR Outlook - General Queries 0 January 9th 07 10:28 AM
Advance Find in Outlook for Birthdate field [email protected] Outlook - General Queries 1 October 10th 06 02:20 PM
Outlook should let me be able to enter a birthdate without a year Jonathan the buble bee Outlook - Using Contacts 0 July 4th 06 03:11 PM


All times are GMT +1. The time now is 10:42 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.