0

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

2
Contributors
1
Reply
3
Views
7 Years
Discussion Span
Last Post by Teme64
0

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 :-/

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.