updating field

tmarsh

tmarsh
Local time
Today, 21:43
Joined
Sep 7, 2004
Messages
89
I have a form with 2 date fields, one contains the date a course was attended and the other (onclick) inserts a date 1 or 2 years ahead to show when an update is due.

I have just added this second date field and was wondering if it is possible to run the code for existing entries rather than clicking each field?
 
You're not trying to store calculated values are you? Calculate them *every* time you need them. If it is on a form then the Current event would be the place to do it along with the AfterUpdate event of each DateControl.
 
RuralGuy said:
You're not trying to store calculated values are you? Calculate them *every* time you need them. If it is on a form then the Current event would be the place to do it along with the AfterUpdate event of each DateControl.
OK, so how do I do that? Each staff member has a list of training done and I want to look at each record and tell which courses are due an update.
 
You will need code similar to the following for each DateField a course was attended. Each txtDateField control will need this code in the AfterUpdate event of the control and the Current event of the Form will need to look at all of the DateFields.
Code:
If IsDate(Me.txtDateField1) Then
   Me.txtUpDate1 = DateSerial(Year(Me.txtDateField1) + 2, Month(Me.txtDateField1), Day(Me.txtDateField1)) '-- Add 2 years to txtDateField1
End If
 

Users who are viewing this thread

Back
Top Bottom