I need a code that will make my form editable when i login with my user id and non editable when others login. I also need a code that will also tell me if a code(like location code) has been existing when ever i try inserting the same code.
not quite right. The name of that table is “Member of” and contains the combinations of users and roles. Which means “which role does a user belong to” and “which users are assigned to this role”.
Thanks alot for the assistance. I went about it in two way to achieve the desire result.The two way are stated below.
Very greatful.
Mem.SETRANGE(Mem.“User ID”,USERID);
Mem.SETFILTER(Mem.“Role ID”,’%1’,‘SUPER’);
IF NOT Mem.FINDFIRST THEN
BEGIN
usersetup.SETRANGE(usersetup.“User ID”,USERID);
usersetup.SETRANGE(usersetup.usereditable,TRUE);
IF NOT usersetup.FINDFIRST THEN
CurrForm.EDITABLE(FALSE)
//ERROR(You 1% cannot edit this form,USERID);
END
Mem.SETRANGE(Mem.“User ID”,USERID);
Mem.SETFILTER(Mem.“Role ID”,’%1’,‘SUPER’);
IF NOT Mem.FINDFIRST THEN
BEGIN
usersline.SETRANGE(usersline.“User ID”,USERID);
usersline.SETRANGE(usersline.allow,TRUE);
IF NOT usersline.FINDFIRST THEN
CurrForm.EDITABLE(FALSE)
{ ELSE
CurrForm.EDITABLE:=TRUE}