How to change date

How to change date

I entered data in form ,in that form from date, to date two fields are there I entered from date is today();

And todate is maxdate();

After one month r some days later

I am entering new record if I entered fromdate is today();

based on this previous todate will be change like previous record todate = current record fromdate-1;

Can any one help whats that code hint?

you mean to say that when you specify the from date field to be Today, the To date field of the previous record should be made = this.fromdate - 1 day?

yes i need like that only

ok then you might try something like this on the table methods

Int64 rec;

ttsbegin;

while select maxof(RecId) from MyTable where MyTable.RecId != this.RecId

{

rec = MyTable.RecId;

select forupdate MyTable where MyTable.RecId==rec;

MyTable.DateTo = this.DateFrom - 1;

MyTable.update();

}
ttscommit;

this is just a rough code but u get the idea. hope it helps.