Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

autoupdate

Status
Not open for further replies.

superhl

IS-IT--Management
Dec 16, 2001
20
0
0
US
Could someone explain to me how to create an autoupdate. I have a field "dob",
And I would like to update the the age the idividual. It worked before upgrading t
to office 2000. thanks
 
You can call this code in your on Current event that has the birthdate on the form


Public Function Age(BirthDate As Date) As Integer
'This Function Takes The Current Date and a Birthdate
'and compares the two to see if there is another year increased
'on the birthdate

Dim intTempAge As Integer

'set initial age
intTempAge = DateDiff("yyyy", BirthDate, Now())

'compare the month if it is this month or earlier then check the
'day if the day is the same day or any previous day then retain
'initial age else subtract one year from the initial age

If ((Month(BirthDate) = Month(Now())) And _
(Day(BirthDate) <= Day(Now()))) Or _
(Month(BirthDate) < Month(Now())) Then

Age = intTempAge
Else
Age = intTempAge - 1

End If

End Function


HTH

Dave
ToeShot@Hotmail.com
Today Is Tomorrows Yesterday. So Why Wait
 
The program continues not to update. Is there any way I could send this database as an attach in order for you to view. Thanks for any help. I have deleted all the important info and now consist of 6 rows.
 
Yes. If it is Larger than 250K Please Zip it.

ToeShot@NetZero.net Dave
ToeShot@Hotmail.com
Today Is Tomorrows Yesterday. So Why Wait
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top