In 7, create a flag to indicate whether the record is locked. Set access
privileges so that records that are locked cannot be edited/deleted
("Limited"). Create a button script that runs with full access to
unlock/lock the record.
Of course, you may not be in FM7...
I had a (somewhat) similar need on a solution I did a couple of years ago.
It was a requirement on many screens, so we worked out a system:
In each relevant table, there's a flag to indicate whether the record is
locked for editing. Call it f_locked, where 1 means it's locked. Set access
privileges to not allow editing of a locked record. Simple enough, except
that if the user can't edit the record, s/he can't unlock it.
So, in a separate table, constant relationship, where globals are stored (we
called ours System), there's a second lock field. It's a global flag we'll
call f_systemlocked, again where 1 means it's locked. (This acts as an
override, so that via script you can temporarily remove the locking
restrictions from the whole system, do your thing, and then lock the system
back up.) Set those access privileges to allow editing where f_locked <> 1
OR system::f_systemlocked <> 1.
A script to lock/unlock a locked record performs the following pseudocode:
allow user abort (off)
if f_locked <> 1
set field f_locked, 1
else
set field system::f_systemlocked, ""
commit
set field f_locked, ""
set field system::f_systemlocked, 1
end if
Don't give the users direct access to either of the flag fields.
--
Shadenfroh
shadenfroh (AT) yahoo (DOT) com
"Railman" <railman (AT) sasktel (DOT) net> wrote
Quote:
Is there a script that can be used to prevent changes on a record once
it has be entered? I am looking for a set of buttons Lock and Unlock
that will prevent careless changes in a record.
--
Never trust a skinny cook. |