You are here:

Using MS Access/Format Field for Yrs/Mths

Advertisement


Pete wrote at 2014-08-14 07:28:07
Thanks Scott,



I used you theory and applied it in the After Update for me.DOB:

   If Me.DOB > Date Then

       Me.DOB = DateAdd("yyyy", -100, Me.DOB)

   End If

   

   Me.AGE = (Date - Me.DOB) / 365.25

   

   dblDiff = Me.AGE

   intYrs = Int(dblDiff)

   intMths = (dblDiff - intYrs) * 12

   TrueYrs = intYrs

   YrsMths = intYrs & "y, " & intMths & "m"

       

   Me.Age2 = TrueYrs



It works exactly as I wanted it to now, many thanks!

Pete


Using MS Access

All Answers


Answers by Expert:


Ask Experts

Volunteer


Scottgem

Expertise

I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience

I've been designing databases for over 25 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

Education/Credentials
Brooklyn College BA

©2016 About.com. All rights reserved.