you're welcome, Ray ~ happy to help
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) |
Tidak ada komentar:
Posting Komentar