Rights to command button usage

C

Chris Carswell

I'd like to have a coupe of command buttons on my startup form, but made
only accessible if the user logged on was a member of a particular Domain
group. Has anyone got any help/code etc?

Thanks,
Chris
(e-mail address removed)
 
J

Jim/Chris

I use userid for onclick event. If another user click on
the butrton nothing happens. You could put an error msg.
I did not put it here but a good idea would be to make it
visible based on the same criteria. This code might get
you started.

Good Luck

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim stDocName As String
Dim stLinkCriteria As String
stLinkCriteria = "[RequestID]=" & Me![RequestID]
If CurrentUser = "userid" _
Or CurrentUser = "userid1" _
Or CurrentUser = "userid2" _
Or CurrentUser = "userid3" _
Or CurrentUser = "userid4" _
Or CurrentUser = "userid5" Then
stDocName = "Requests IT"

DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
End If
Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top