You could change the Current Date field from unstrored calculation to a simply date field and put into it the current date on open the DB.
Thank you for your reply.
This seams a nice idea.
But the user could still change the date of the computer before entering the database. An we will end up with the same problem.
The issue is that I am making this Lock option for medico-legal purpose (so that the assessment could no longer be changed no matter what).
Thank you again.
My answer was related to the subject of your post.
But the same script could control the state of the Lock field ( if it was 1, it will remain 1 )
I would use the OnRecordLoad trigger to perform a script that checks the date and locks the record if it is unlocked and that leaves it locked if already locked.
Set Field [ YourTable::Lock ; If ( Not Lock ; Get ( currentDate ) > AutoLockDate ) ]
In fact, I have tried a lot but the calculation result came back to empty once I change back the computer's date to a previous date.
This is because the calculation field is unstored.
The problem is that, when we must recheck the date (on Database open or on Record load), it will check the new computer's date.
So, what I have done is that I have used the idea of Raybaudi (thanks to you).
This way, I will have a stable date when the database is opened.
Then I have made a script that will run on database exit that will definitively lock the fields, using a simple text field.
Thank you all for your help.