Hi! I have five text boxes & one button there in my form. I have written this code to get user`s current age. But problem is that I have to get user`s age with months. I am little bit confused. Please help me.

My code to get age :

Private Sub Command1_Click()
BDate = Text1.Text & "-" & Text2.Text & "-" & Text3.Text
CurDate = Now
Text5.Text = DateDiff("yyyy", BDate, CurDate)
End Sub

My code to get age with months :

Private Sub Command1_Click()
BDate = Text1.Text & "-" & Text2.Text & "-" & Text3.Text
CurDate = Now
Text4.Text = DateDiff("m", BDate, CurDate)
Text5.Text = DateDiff("yyyy", BDate, CurDate)
End Sub

I didn't quite get what's the problem. Your code (the latter Command1_Click) does count the user's age in months and years correctly. I tried that snippet with a birthdate "1-1-2000". The results are Text4.Text = "125" and Text5.Text = "10" which is correct. Am I missing some point in here :-/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.