Hello there!

I need your expertise in vb6. I made a new exercise for my vb6 subject using database Microsoft access. With the fields of FirstName, MiddleName, LastName, Birthdate and Age. and there is correct information of my family in every fields. Using navigation command. Im using Microsoft ADO Data control 6.0 or ADODC. Im using Microsoft.Jet. OLEDB 4.0 to connect the database. With text box in the form in every fields. I bind the all fields except the age. I want the correct age display in the text box in every family information i have. Can share me a correct procedure or code for my exercise i made. Thank you very much....

Here's the example:

First Name: Edwin
Middle Name: Quiroben
Last Name: Paglinawan
Birth Date: Oct/6/1970
Age:

On age text bxo it should display the correct age with my birthdate minus with the year of the system. The Edwin Quiroben paglinawan and oct/06/1970 is in text box because they are in the database....

If I understand your problem then in the Change event of the birth date text box put something like the following:

Dim DateNow As Date
Dim DateBD As Date

DateNow = Now()

' The following asumes the Birthday textbox is called txtBD and 
' The age textbox txtAge

DateBD = CDate(txtBD.Text)

txtAge.text = DateDiff("YYYY", DateBD, DateNow)

' you may need a me.refresh or/and a doevents here

Hope that answers your question.

Thank you sir i got your code its working.

txtAge.text = DateDiff("YYYY", DateBD, DateNow)

This question has already been answered. Start a new discussion instead.