View Single Post
  #2 (permalink)  
Old August 15th, 2008, 09:42 AM
BrianWren BrianWren is offline
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Something like this:
Code:
  Year(CDate("January 15, 2008")) - Year(CDate("September 9, 1985"))
almost gives you the answer. But it is only accurate after 9/9 any year. So if the date is after December 31, midnight (after New Year's), but before the birthday, you need to subtract 1.

Statements that are True or False = -1 if True, and 0 if False.

Adding a minus value subtracts the absolute value of it.

So if you [u]add</u> to the statement’s value (the purple part is pseudocode)
Code:
  + (TheDayOfTheYearOf(CDate(textbox1.Text)) < _
     TheDayOfTheYearOf(CDate(textbox2.Text)) _
    )
Reply With Quote