Can anyone please help!!!!!
I have a form where I have a text box called "Birthdate"
Then another text box called "age".
I am using this code
Dim dbs As Database
Dim rst As Recordset
Dim lngdays As Long
Dim dblYears As Double
Dim datBirthdate As Date
Dim intage As Integer
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("age", dbOpenDynaset)
With rst
Do While Not .EOF
datBirthdate = ![Birthdate]
lngdays = DateDiff("d", datBirthdate, Now())
dblYears = lngdays / 365
intage = Int(dblYears)
.Edit
![age] = intage
.Update
.MoveNext
Loop
.Close
End With
The problem that I have is when I enter the birthdate in on the form nothing appears in the age text box.
The information only appears when the form is loaded as set up in the properties.
What I would like to happen is when I have finished entering the birthdate the information will appear straight away in the age text box.
Any clues where I put this event procedure????
Cheers
HL
I have a form where I have a text box called "Birthdate"
Then another text box called "age".
I am using this code
Dim dbs As Database
Dim rst As Recordset
Dim lngdays As Long
Dim dblYears As Double
Dim datBirthdate As Date
Dim intage As Integer
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("age", dbOpenDynaset)
With rst
Do While Not .EOF
datBirthdate = ![Birthdate]
lngdays = DateDiff("d", datBirthdate, Now())
dblYears = lngdays / 365
intage = Int(dblYears)
.Edit
![age] = intage
.Update
.MoveNext
Loop
.Close
End With
The problem that I have is when I enter the birthdate in on the form nothing appears in the age text box.
The information only appears when the form is loaded as set up in the properties.
What I would like to happen is when I have finished entering the birthdate the information will appear straight away in the age text box.
Any clues where I put this event procedure????
Cheers
HL