Limit input based on username

N

NewSysAdmin

I have a text box (which is a numerical field) on a form in which I would
like to limit input based on the user logged in. Is this possible? If it
is, how would I approach this? Thank you for any suggestions.
 
S

Sprinks

You can use CurrentUser to return the user name. Depending on how many
people you have, it might be simpler to do it by a security group.

In one of my applications, I load a menu form for Managers users and a basic
timesheet form for everyone else. On the menu form, I have a hidden
programmer menu at the bottom to switch AllowEditBypass on and off that I
make visible if I'm the CurrentUser:

In the OnOpen event of the form that opens in hidden mode when the
application loads:

Dim strFormName As String

'If user is a member of Managers, open Admin menu, otherwise open
Timesheet
If adhIsGroupMember("Managers") Then
strFormName = "Administrative Main Menu"
Else
strFormName = "Timesheet"
End If

DoCmd.Close
DoCmd.OpenForm strFormName

In the OnOpen event of the Administrative Main Menu:

Dim ctl as Control
If CurrentUser() = "ksprinkel" Then
For Each ctl in Me.Controls
' Turn on programmer controls by its Tag property value
If ctl.Tag = "Programmer" Then
ctl.Visible = True
End If
Next ctl
End If

Hope that helps.
Sprinks
 
Top