Thanks John, As I'm still learning Access, and especially trying to learn the "big picture" (good practices and why to use one method over another), could you please tell me why you'd choose the VBA function over putting a normal Access expression inside the unbound text control? Off the top of my (admittedly ignorant) head, the only advantage I can see would be to make it perhaps a little
Received: from [72.66.229.69] by openbrick.kicks-ass.net (ArGoSoft Mail Server Pro for WinNT/2000/XP, Version 1.8 (1.8.6.0)); Sat, 9 Feb 2008 19:35:22 -0500 Return-Path: <jracine@usxpress.com> Received: from 209.215.149.65 (HELO navgw.usxpress.com) by openbrick.kicks-ass.net with esmtp (KNBZVNVQRBTC LAOLY) id bzmB5S-LFpysQ-i for [spamtrap]; Sat, 09 Feb 2008 19:35:25 -0500 Message
Jasmine, I strongly discourage storing the [Age] in a field. Since this value changes quite frequently (for at least some portion of your client base), it is much smarter to compute this value on the fly. There are several techniques for this, but I liked the one that James Fortune posted a couple of days ago CurrentAge = Int(Format(Date(), "yyyy.mmdd") - Format([DOB], "yyyy.mmdd")
Jasmine, I strongly discourage storing the [Age] in a field. Since this value changes quite frequently (for at least some portion of your client base), it is much smarter to compute this value on the fly. There are several techniques for this, but I liked the one that James Fortune posted a couple of days ago CurrentAge = Int(Format(Date(), "yyyy.mmdd") - Format([DOB], "yyyy.mmdd")
"James A. Fortune" wrote: skrysiak wrote: is there any way to calculate age from 2 date fields in years For the age in years from dt1 to dt2 I use (VBA): intCurrentAge = Int(Format(dt2, "yyyy.mmdd") - Format(dt1, "yyyy.mmdd")) In SQL: SELECT Int(Format(Date(), "yyyy.mmdd") - Format([BirthDate], "yyyy.mmdd")) As CurrentAge FROM MyTable WHERE BirthDate IS