yang pernah saya dapat seperti ini ( Function di VB tidak tahu di Access bisa tidak )
Public Function CalcAge(ByVal DOB As Date) As String Dim CurDate, CurMonth, CurYear Dim BirthDate, BirthMonth, BirthYear Dim DiffDays, DiffMonths, DiffYrs Tahun = 0 Bulan = 0 Hari = 0 CurDate = Day(Date) CurMonth = Month(Date) CurYear = Year(Date) BirthDate = Day(DOB) BirthMonth = Month(DOB) BirthYear = Year(DOB) If BirthDate > CurDate Then Select Case Month(Date) Case 1, 3, 5, 7, 8, 10, 12 dysadd = 31 Case 4, 6, 9, 11 dysadd = 30 Case 2 If Year(Date) Mod 4 = 0 Then dysadd = 29 Else dysadd = 28 End If End Select CurDate = CurDate + dysadd CurMonth = CurMonth - 1 DiffDays = CurDate - BirthDate Else DiffDays = CurDate - BirthDate End If If BirthMonth > CurMonth Then CurMonth = CurMonth + 12 CurYear = CurYear - 1 DiffMonths = CurMonth - BirthMonth Else DiffMonths = CurMonth - BirthMonth End If DiffYrs = CurYear - BirthYear If Len(DiffYrs) = 1 Then Tahun = "0" & DiffYrs Else Tahun = DiffYrs End If If Len(DiffMonths) = 1 Then Bulan = "0" & DiffMonths Else Bulan = DiffMonths End If If Len(DiffDays) = 1 Then Hari = "0" & DiffDays Else Hari = DiffDays End If End Function ----- Original Message ----- From: "harry siswanto" <[EMAIL PROTECTED]> To: "IT Centre" <itcenter@yahoogroups.com> Sent: Thursday, August 04, 2005 4:23 PM Subject: [ITCENTER] Rumus cari Umur pake MsAccess > Dear all > > > butuh bantuannya nih, > Gimana Prosedur/Program-nya untuk cari umur seseorang. > dgn Input: Tgl Lahir & Tgl Saat ini > dgn result: Umur= ...Th .... Bln. > > terima kasih sebelumnya. > > > > > > ____________________________________________________ > Start your day with Yahoo! - make it your home page > http://www.yahoo.com/r/hs > > > > > > -- > www.itcenter.or.id - Komunitas Teknologi Informasi Indonesia > Info, Gabung, Keluar, Mode Kirim : [EMAIL PROTECTED] > ::: Hapus bagian yang tidak perlu (footer, dst) saat reply! ::: > ## Jobs: itcenter.or.id/jobs ## Bursa: itcenter.or.id/bursa ## > $$ Iklan/promosi : www.itcenter.or.id/sponsorship $$ > > > Yahoo! Groups Links > > > > > > > -- www.itcenter.or.id - Komunitas Teknologi Informasi Indonesia Info, Gabung, Keluar, Mode Kirim : [EMAIL PROTECTED] ::: Hapus bagian yang tidak perlu (footer, dst) saat reply! ::: ## Jobs: itcenter.or.id/jobs ## Bursa: itcenter.or.id/bursa ## $$ Iklan/promosi : www.itcenter.or.id/sponsorship $$ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/ITCENTER/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/