Updating Field using DateDiff

spalmateer

Registered User.
Local time
Today, 02:22
Joined
Dec 5, 2000
Messages
46
Hi,
I have two fields on my form. One is Unit Installed and the other is Unit Age. I would like to use VB to update the Unit Age field after entering a date into Unit Installed. I'm using this expression to find the age: =DateDiff("yyyy",[Unit Installed],Now())+Int(Format(Now(),"mmdd")<Format([Unit Installed],"mmdd")). Thanks for any help and insight!
Scott
 
I'm not sure if this is what you're asking but ry this:

Private sub txtUnitInstalled_AfterUpdate()
me.txtUnitAge = ' put your expression here.
End Sub

As the user enters a date value into the txtUnitInstalled control, this event procedure will be fired which will cause the text in the tex tcontrol "txtUnitAge" to become the value of your expression.

ntp
 

Users who are viewing this thread

Back
Top Bottom