Partial Security

Sol

Registered User.
Local time
Today, 23:42
Joined
Feb 24, 2000
Messages
31
Hi,

Is it possible to assign partial security to a form based on user ie. a use has access to select fields and not others?

Thanks!
Sol
 
Here's one way to do it. In the Properties for the fields that you want to turn on & off, put a name in the Tag.

In my example, the Tag is "Coord_btn"

Then put some code like this in the Form Load:

Set frmMyForm = Forms!fMainMenu
Select Case strUserID
Case "12345" "23456" "34567" 'these would be the userids that can see stuff
For Each ctlMyCtls In frmMyForm.Controls
If ctlMyCtls.Tag = "Coord_btn" Then
ctlMyCtls.Visible = True
ctlMyCtls.Enabled = True
End If
Next ctlMyCtls

Case Else
For Each ctlMyCtls In frmMyForm.Controls
If ctlMyCtls.Tag = "Coord_btn" Then
ctlMyCtls.Visible = False
ctlMyCtls.Enabled = False
End If
Next ctlMyCtls
End Select
Set frmMyForm = Nothing

If you do this, you'll end up changing the code each time a user is added or deleted, so I'd suggest figuring out a way to group users, maybe be validating them against a table. You can also have multiple tags to turn on different items.
 

Users who are viewing this thread

Back
Top Bottom