Discussion Locked

Access 2002 Dates

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Please Help,
I am trying to create 10 to 12 fields that have a default
value based on the DATE of another field. All of these
fields rely on the field called "enter date". Their value
will be "enter date" + 90 days, 4 months, or 60 days. SoI suppose my goal is to have these dates show up on a
form already determined based on the "entered date" field
and also stored in a table.

Thanks for any help,
Carl
carljohnman1819@msn.com

5 replies

by kees.valkenswaard

Suppose you have a field EntDate for your Enter Date, and fields Dat90, Dat4M and more.
A first, simple approach would be to use a form and attach a procedure OnExit to the textbox for EntDate:

Private Sub EntDate_Exit(Cancel As Integer)
IfNot IsEmpty([EntDate]) Then
[Dat90] = [Entdate] + 90
[Dat4M] = DateAdd("m", 4, [EntDate])
End If
End Sub

No error handling has been added. Other events could be used and all these fields should be date/time.
Good luck

by richtee

One way of accomplishing what you want is to put some code behind the ?AfterUpdate? event of the ?DATE? control.

Assuming the names of your unbound controls are as follows:

DATE, Date60, Date90, Date120, Date160, etc.

Use the following codefor the AfterUpdate event of the DATE control

Private Sub DATE_AfterUpdate()

Date60.Value = DATE.Value + 60
Date90.Value = DATE.Value + 90
Date120.Value = DATE.Value + 120
Date160.Value = DATE.Value + 160

End Sub

In properties, format the dates the way you want them to appear and after entering the date in the ?DATE? control, all the other controls will calculate to their corresponding values.

Good Luck
Rich

This discussion is closed to new replies.