On update date calculation

Sgt Bilkp

Registered User.
Local time
Today, 21:20
Joined
Jan 11, 2008
Messages
66
Having trouble with my date again! She doesn't appreciate what I.........oops wrong forum!

No seriously, is it possible to have a form automatically enter a date in a text box?

frmTraining is the main form.

On adding a new training course event (for example, First Aid) a combo box obtains the relevent course from tblCourses. Shown on the form is the cost, duration of training days, location etc which are all contained in tblCourses.

Other fields (bound to tblTraining) are dateplanned, datestarted, datecompleted. Another field contained is a date field QualPassed which is used when a manditory qualification applies.

One field not displayed, and contained in tblCourses, indicates the duration that the qualification is valid for (QualDuration). This is in months.

What i would like to happen when someone enters the date in QualPassed is that the date in QualExpiry is automatically added, based on the value in QualDuration for that course.

For example,

New course selected, "First Aid" which expires in 36 months. The user completes all fields, and then enters QualPassed date of 08/09/08. The form then adds the date into QualExpiry of 08/09/11.
 
Since you're using the combobox to pull the course name, why not pull QualDuration as the second column in its RowSource at the same time? Then use something like this:

Private Sub QualPassed_AfterUpdate()
Me.QualExpiry = DateAdd("m", Me.CourseCombo.Column(1), Me.QualPassed)
End Sub
 
Took a little fiddling (had to use column 2) but got it!

Again, many thanks.
 
So you already had more than one column. Glad you got it working.
 

Users who are viewing this thread

Back
Top Bottom