Default Date Value Based on another date field

striker

Useless and getting worse
Local time
Today, 18:04
Joined
Apr 4, 2002
Messages
65
I have two date fields in a table DateRaised and ReviewDate.

The ReviewDate field should be filled at data entry, but this date may not be known at the time. What I want to do is add a default value of a review date six months hence in this field.

For information the DateRaised is not neccessarily the date the record was created.
 
Striker,

Experiment by putting code similar to this in the On Current Event of your form -- your form which must include a textbox (hidden or otherwise) for ReviewDate, a field in a table.

Code:
If me.newrecord = true then

	Me.txtReviewDate = dateadd("m",6,date)

End if

Regards,
Tim
 
I've tried various places for thst code but I cannot get it to work at all. Am I being particularly thick or is the code not right.
 
See if this works, place this code in the OnCurrent event of the form

Code:
Private Sub Form_Current()

If Me.DateRaised <> "" Then
Me.ReviewDate = DateAdd("m", 6, [DateRaised])
Else
Me.ReviewDate = ""
End If

End Sub

IMO
 
Last edited:
IMO,

Works a treat But, how do I get the change to show up on the form when the change is made and not only when you move between records.

Cheers.
 
You could put the code in the LostFocus event of the Me.DateRaised control, but remember when you need to edit the Me.ReviewDate control, don't let Me.DateRaised getfocus.Have it's settings as Enabled = No, Locked = Yes

IMO
 
Now I am completely confused.

Ho do I set that then.
 
Here's a quick example of what I mean.

IMO
 

Attachments

Users who are viewing this thread

Back
Top Bottom