954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need your expertise vb6 programmer

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....

dwiniers
Junior Poster in Training
57 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
 

Lets see what you have done so far.

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

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....

dwiniers
Junior Poster in Training
57 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
 

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.

lastpilgrim
Newbie Poster
11 posts since Jul 2007
Reputation Points: 10
Solved Threads: 1
 

Thank you sir i got your code its working.

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

dwiniers
Junior Poster in Training
57 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
 

Sorry but i didn't understand what are you trying to say

Mohammed Ammar
Light Poster
26 posts since Oct 2011
Reputation Points: 5
Solved Threads: 1
 

very good i was also in need of that..

good job.

4ukh
Junior Poster in Training
70 posts since May 2008
Reputation Points: 13
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You