Hi Spencer,
Use the Form_Open event procedure. Something like this, where NTUserID1 and
NTUserID2 represent the NTUser ID's that these people use to log into Windows:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo ProcError
Dim strUserName As String
strUserName = fOSUserName
Select Case strUserName
Case "NTUserID1", "NTUserID2" 'These people can see the buttons
Me.lblLabelName.Visible = True
Me.cmdButtonName.Visible = True
Case Else
Me.lblLabelName.Visible = False
Me.cmdButtonName.Visible = False
End Select
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure Form_Open..."
Resume ExitProc
End Sub
You can grab a copy of the fOSUserName function here:
Get Login name
http://www.mvps.org/access/api/api0008.htm
I would appreciate the code to do it either way...
The SELECT CASE part of the code would be similar if you are using ULS (User
level security) in Access. However, I tend to avoid using ULS, so you'll need
to work out how to grab the logged on user. I think it might be the
CurrentUser function, so instead of Select Case strUserName, you would have
Select Case CurrentUser, and you would not need the fOSUserName function.
Tom Wickerath
Microsoft Access MVP
http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________