On Mon, 26 Dec 2005 04:55:07 GMT, jim Bob <fr****@gmail.com> wrote:
Hi Wayne,
Thanks a lot for the reply.
How do i USE this code?
Eg do i put it as a macro or module or paste the code into the table in
Design view?
Cheers
*** Sent via Developersdex http://www.developersdex.com ***
You need to enter the data in a Form in order to make this work. Entering the data directly into a table will not
trigger the calculation.
Create a form which includes StartDate, OffProbationDate and any other fields you require from your table. You can use
the Form Wizard to create this form if you want.
Once you have the form, open it in design view and click on the StartDate control and open it's properties sheet. (right
click - properties).
Click on the Event tab and select AfterUpdate. Click the (...) button which appears at the right of the property. Select
Event Procedure. The form's code module will open with the header and footer for the procedure auto created as such -
Sub StartDate_AfterUpdate()
End Sub
Paste the following code between the header and footer lines -
If Not IsNull(Me.StartDate) Then
Me.OffProbationDate = DateAdd("m",3,Me.Startdate)
Else
Me.OffProbationDate = Null
End If
Open the form in normal mode. When you enter a date in StartDate, OffProbationDate will be set to 3 months ahead of the
StartDate. If StartDate is deleted OffProbationDate will also be deleted.
Wayne Gillespie
Gosford NSW Australia