Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Projecting future dates

Status
Not open for further replies.

Sentra52

Technical User
Aug 16, 2002
14
0
0
US
I'm trying to get access to project future dates from the date i initially enter. For example, If I entered 6 Jan 2002, I would want one field to project out 3 months, another 6 months, and the third one year.

Thanks in Advance
 

Sentra

Behind the fields AfterUpdate command try this code (adapted to your form)

Private Sub InitialDate_AfterUpdate()

SixMonthDate = DateSerial(DatePart("yyyy",InitialDate), DatePart("m", InitialDate) + 6, DatePart("d", InitialDate))

OneYearDate = DateSerial(DatePart("yyyy",InitialDate)+1, DatePart("m", InitialDate), DatePart("d", InitialDate))

End Sub

All this code does is break down the date into seperate parts d/m/y and adds on the number you require to whichever part.

Andy
 
Hi Sentra52,
Using Access 2000:
In the after update event of the date your are entering, set the other date fields using the DateAdd function.
Example:

Private Sub Action_Date_AfterUpdate()

newdate= DateAdd("m", 3, Action_Date)

End Sub

The above example sets date field newdate to value of Action_Date plus 3 months.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top