increase date

tubar

Registered User.
Local time
Today, 16:57
Joined
Jul 13, 2006
Messages
190
if i have a field called "relamp date" and another field "expectency" i need to write an after update code so when the user inputs 8/17/09 into the "relamp date" and the expectancy field is set for 24 (which means 24 months) i need 8/17/11 to automaticaly be put in the "next relamp" field

can some one help me with a code to put in the after update of the "relamp date" field
 
This is one of those times, until you have Data Macros in Access 2010, that you need to NOT store the value but calculate it when needed in a query. You should not store calculated values in the database (99% of the time) and this falls into the 99% of the time. You are storing the initial date and the number of months to be added. That gives you the data to do the calculation in a query at runtime.
 
ok...that sounds great...i have a problem still....

relamp date field is 12/1/09
expectency field is 24
the querry is thinking expectency is 24 days...how can it be months
 
ok...that sounds great...i have a problem still....

relamp date field is 12/1/09
expectency field is 24
the querry is thinking expectency is 24 days...how can it be months

In the query you use

NewFieldName:DateAdd("m", 24, [relamp date])

or if the 24 is in the field expectency:

NewFieldName:DateAdd("m", [expectency], [relamp date])
 

Users who are viewing this thread

Back
Top Bottom