Selasa, 19 Februari 2019

Re: [MS_AccessPros] Read only forms in a database

 

you're welcome, Ray ~ happy to help

On 2/19/2019 9:45 AM, rayfrew@gmail.com [MS_Access_Professionals] wrote:
Thanks Crystal


---In MS_Access_Professionals@yahoogroups.com, <strive4peace2008@...> wrote :

hi Ray,

use the form OPEN event to evaluate who the user is. If they are a read-only user, then lock all the controls. If they can change the data, then unlock them.

Function LockUnlockControls( _
   pForm As Form _
   , pBoo As Boolean _
   , Optional pControlFocus As String = "" _
   ) As Boolean
 'Crystal, strive4peace, 1/7/08, 121121, 151123
 
   On Error GoTo Proc_Err
   LockUnlockControls = False
 
   Dim ctl As Control
 
   'if a controlname is specified for the focus, then move it
   If Len(pControlFocus) > 0 Then
      pForm(pControlFocus).SetFocus
   End If
 
   'loop through all controls in the Detail section

   For Each ctl In pForm.Detail.Controls
      ' set the Locked property according to what was passed
         If Not ctl.Locked = pBoo Then ctl.Locked = pBoo
      End If
   Next ctl
 
   LockUnlockControls = True
 
Proc_Exit:
   On Error Resume Next
   Set ctl = Nothing
   Exit Function
 
Proc_Err:
   MsgBox Err.Description, , _
        "ERROR " & Err.Number _
        & "   LockUnlockControls"
 
   Resume Proc_Exit

   'if you want to single-step code to find error, CTRL-Break at MsgBox
   'then right-click on "Resume" and choose --> Set Next Statement
   'press F8 to resume with the line that threw the error so you can inspect it
   Resume
 
End Function

~crystal

On 2/17/2019 10:21 AM, rayfrew@... [MS_Access_Professionals] wrote:

Hi everyone

Is it possible to switch all forms in a database to become read only?  I have a sign-in screen where I detect who the user is.  For certain users I want them to view the information but not update it.  Is that possible?

Thanks

Ray

__._,_.___

Posted by: crystal 8 <strive4peace2008@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (6)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


SPONSORED LINKS
.

__,_._,___

Tidak ada komentar:

Posting Komentar