I have a database which has some dates in it. I need to as part of the form also calculate some projected dates in 3 other fields. I am having trouble trying to get the dates to calculate.
Starting with the simplest date calculation I have searched the site and found how to add a field which immediately calculates. I've amended the code to be:
<script>
document.forms.editform.value_LStart.onchange=document.forms.editform.value_LLength.onchange=function()
{
document.forms.editform.value_Test.value = document.forms.editform.value_LStart.value+document.forms.editform.value_LLength.value;
}
</SCRIPT>
If LStart is 05 November 2009 and LLength 10, Test becomes 2009-11-510 (which of course is wrong)
LStart is a date.
LLength is a period.
I was expecting it to output 2009-11-15 in field Test, so realise that there needs to be more to the code.
Infact I needed the output to be in a date field with the answer 15 November 2019 as LLength needs to be in years.
In MSAccess I've managed this by multiplying the LLength by 365.3 to add days to LStart.
Can the code be amended to allow calculation of dates and output this to the field Test.
Thanks
Jeremyb