Question Locked

Locking a Field after editing

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How do I lock a specific field after editing (i.e. I have a list of consultants from a drop down list. I would like to lock a consultant to a particular record once the consultant has allocated that record to themselves. I don't want anyone else changing the consultant next to that record except myself, the administrator). Your help would be greatly appreciated. Cheers.

4 replies

by toivo talikka

You may need to build the controls to the logic in your code. Even if you could modify the access rights at the field level (depending on the database system), it may be too tricky to try to change the rights on the fly.

You may need a subroutine similar to this (in PHP):

function check_update($consultant_in_table, $logged_in_user, $administrator) {
$allow_update = FALSE;
if ($consultant_in_table == "") {
$allow_update = TRUE;
}
if ($logged_in_user == $administrator) {
$allow_update = TRUE;
}
return $allow_update;

Your code would set the input variables and test the value returned by the function when it needs to decide if the user can change the field.

by ngu78

Thanks Toivo, it sounds like you know what you're talking about. Unfortunately I'm not a programmer and don't quite understand how to go about this. In the properties of the field in question, I've copied and pasted your script into the code builder but it doesn't seem to work. My table is called "Vendors". The field I wish to lock after editing is called "Broker". Do I also need to specify the exact users who are and aren't allowed to update this field? Thanks again for your help :)

by toivo talikka

My code was meant to be just pseudocode, demonstrating what could be done. You may want to apply similar logic, and the finer details may need someone's involvement who is familiar with the code builder you are using and the programming language it generates.

This discussion is closed to new replies.