Re: Protecting a field within a form
- From: John Nurick <j.mapSoN.nurick@xxxxxxxxxxxxxx>
- Date: Mon, 13 Feb 2006 21:58:15 +0000
Here's a function (there are many versions around) which tells you
whether or not a user is in a given security group:
Public Function IsUserInGroup(strGroup As String, _
strUser As String) As Boolean
Dim Dummy As String
On Error Resume Next
Dummy = DBEngine(0).Users(strUser).Groups(strGroup).Name
IsUserInGroup = (Err.Number = 0)
Err.Clear
On Error GoTo 0
End Function
If you stick it in a module (a standard module, not a class module or a
form's module) you can do stuff like this in a form's Open event
procedure:
If IsUserInGroup("MoltoAdministroso", CurrentUser()) Then
cboImportantStuff.Locked = False
Else
cboImportantStuff.Locked = True
End If
On Mon, 13 Feb 2006 06:16:27 -0800, "sonfitz"
<sonfitz@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
John you hit on what I'm trying to do however, I'm not familar with VBA code
to accomplish this. Could you point me to where I could find the info on how
to plug the proper VBA code into the Open Event procedure. This would
accomplish what I'm trying to do which again is to limit who can modify and
who can only view a particular field, in this case a drop down combo-box,
within the form.
Thanks ahead of time for your help.
Jay
"John Nurick" wrote:
I don't understand the purpose of your new table.
To meet the situation you originally explained, ignore my previous posts
and follow John Vinson's suggestion: set things up so the users can only
access the data via your forms, and on the forms lock the controls that
display the fields you don't want the users to be able to modify.
To lock or unlock the controls depending on the user, you have to use
VBA code in the form's Open event procedure that gets the user name,
checks their permissions, and adjusts the Locked property of the
controls accordingly.
On Mon, 6 Feb 2006 14:08:28 -0800, "sonfitz"
<sonfitz@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I appreciate your suggestions although that did work I need to have the
ability to modify the field within this form if the person has sufficent
permissions. The field I want to ba able to modify if the person has the
right is a drop down combo box.
I tried creating another table and created a form based upon that new table
which just had one field in it. That field was a drop down combo box that I
added two peices of info. In my main form I created a subform area to
display this one field and I have not had much luck in getting the info to
display corretly. I just want to be able to limit that drop down box to who
can modify and who can only view the data while being able to modify the
other fields in the form.
"John Nurick" wrote:
On Sat, 04 Feb 2006 15:57:58 -0700, John Vinson
<jvinson@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
On Sat, 04 Feb 2006 18:42:17 +0000, John Nurick
<j.mapSoN.nurick@xxxxxxxxxxxxxx> wrote:
RWOP queries? - or maybe I'm missing the point.
Can you set a RWOP query to allow one field to be edited and another
to be protected, in the same query? That would be neat but I don't
know how!
I read - or misread - the OP as wanting to restrict visibility rather
than updatability...
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
.
- References:
- Re: Protecting a field within a form
- From: John Vinson
- Re: Protecting a field within a form
- From: John Nurick
- Re: Protecting a field within a form
- From: John Vinson
- Re: Protecting a field within a form
- From: John Nurick
- Re: Protecting a field within a form
- From: John Nurick
- Re: Protecting a field within a form
- From: sonfitz
- Re: Protecting a field within a form
- Prev by Date: Re: Elapsed Time
- Next by Date: Re: How do I open an email that used excell sprdsht. when I dont have
- Previous by thread: Re: Protecting a field within a form
- Next by thread: Re: How do I get the initial "Database Window w/Objects"?
- Index(es):
Relevant Pages
|