Normal Topic Read Only Access (Read 689 times)
jyellis
Full Member
Members
***
Offline


No personal text

Posts: 114
Location: Dallas-Fort Worth Area
Joined: May 19th, 2003
Read Only Access
May 24th, 2005 at 2:18pm
Print Post Print Post  
I have a user that I want them to only have access to search & view data via the forms.

I have tried through the Security Mgr; Layout/Layout Elements Settings but I can't seem to get the settings where this user can search but not edit.

Thanks for your help.
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Read Only Access
Reply #1 - May 24th, 2005 at 2:42pm
Print Post Print Post  
Hello Judy,

Put this code in your form on form entry event

Code
Select All
Var vElements as String
Var vUsers as String
Var vCnt as Int
Var vLoop as Int
Var vUser as String
Var vName as String

    vElements = @StringArrayElementList()
    vCnt = @CountStringArray(vElements)
    vLoop = 0
    vUsers = "Sally;Rob;Joe"
    vUser = @UserID

    If @FindStringArray(vUsers, vUser) > 0 Then
    {
	  While vLoop < vCnt
	  {
		vLoop = vLoop + 1
		vName = @AccessStringArray(vElements, vLoop)
		SetThisElement(vName)
		//If you want the elements to not be grayed out but still readonly
		//Change the 1 on the next line to a 2
		ReadOnly(ThisElement, 1)
	  }
	  UnSetThisElement()
    }
 



Put this code in your Form On Retrieve Spec open event

Code
Select All
Var vElements as String
Var vUsers as String
Var vCnt as Int
Var vLoop as Int
Var vUser as String
Var vName as String

    vElements = @StringArrayElementList()
    vCnt = @CountStringArray(vElements)
    vLoop = 0
    vUsers = "Sally;Rob;Joe"
    vUser = @UserID

    If @FindStringArray(vUsers, vUser) > 0 Then
    {
	  While vLoop < vCnt
	  {
		vLoop = vLoop + 1
		vName = @AccessStringArray(vElements, vLoop)
		SetThisElement(vName)
		//Make all elements writeable
		ReadOnly(ThisElement, 0)
	  }
	  UnSetThisElement()
    }
 



This will make all the elements on the form read-only for the users Sally, Rob, and Joe but only in Update mode or in Add Data mode. In Search mode all the elements are made writable so the user can type in a retrieve spec.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
jyellis
Full Member
Members
***
Offline


No personal text

Posts: 114
Location: Dallas-Fort Worth Area
Joined: May 19th, 2003
Re: Read Only Access
Reply #2 - May 24th, 2005 at 3:02pm
Print Post Print Post  
Thank you so much.

Let me asked another question though....If this user searches; can I block them from saving the record?
  
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Read Only Access
Reply #3 - May 24th, 2005 at 4:06pm
Print Post Print Post  
Just add NotifyForm(1) to your other actions to prevent saving, something like this:

   If @FindStringArray(vUsers, vUser) > 0 Then
    {
  NotifyForm(1)
   While vLoop < vCnt
  {
  vLoop = vLoop + 1


---------------------------------
Use NotifyForm(0) to reenable Save when needed.


  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged