Re: Locked property
From: shaggles (anonymous_at_discussions.microsoft.com)
Date: 07/20/04
- Next message: Richard Hollenbeck: "Send Results of SQL Statement Into an Array of Unknown Size?"
- Previous message: Allen Browne: "Re: Locked property"
- In reply to: Allen Browne: "Re: Locked property"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 20 Jul 2004 09:54:19 -0700
I was able to get this to work:
If Me!UserID = CurrentUser() Then
Me.AllowEdits = True
Else
Me.AllowEdits = False
End If
I set the locked property for Response and Sign_Off on the
Property *** to No and on everything else to Yes. Are
there any drawbacks to doing it this way?
>-----Original Message-----
>UserID is a Text type field?
>CurrentUser() is a function, so try adding the brackets.
>
>This example sets a flag to lock the text boxes if the
UserID in the form is
>not the same as CurrentUser(). It also locks the fields
if there is not
>UserID (e.g. at a new record).
>
>Private Sub Form_Current()
> Dim bLock As Boolean
> bLock = Not Nz(Me!UserID = CurrentUser(), False)
> Me!Response.Locked = bLock
> Me!Sign_Off.Locked = bLock
>End Sub
>
>
>--
>Allen Browne - Microsoft MVP. Perth, Western Australia.
>Tips for Access users - http://allenbrowne.com/tips.html
>Reply to group, rather than allenbrowne at mvps dot org.
>
>"shaggles" <anonymous@discussions.microsoft.com> wrote in
message
>news:00c601c46dc9$409ad700$a501280a@phx.gbl...
>> I am trying to set the Locked property of a comment
field
>> based on the user id. I got the following code from vb
>> help in access but I get an error message saying the
>> object doesn't support this property or method. The
field
>> I'm trying to lock are on a subform. Does that make a
>> difference? I put the code in the On Curent event of
the
>> subform.
>> Private Sub Form_Current()
>> If Me!UserID = CurrentUser Then
>> Me!Response.Locked = False
>> Me!Sign_Off.Locked = False
>> Else
>> Me!Response.Locked = True
>> Me!Sign_Off.Locked = True
>> End If
>> End Sub
>
>
>.
>
- Next message: Richard Hollenbeck: "Send Results of SQL Statement Into an Array of Unknown Size?"
- Previous message: Allen Browne: "Re: Locked property"
- In reply to: Allen Browne: "Re: Locked property"
- Messages sorted by: [ date ] [ thread ]