Different Start Menus

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using user level security just fine, although it took quite a bit of
failure just to become "less nervous" about security.

What I need is for the different user groups to have a different form that
they start with. Teachers would have the frmMainTeacher, adminsitrators,
frmMainAdmin, etc.

Is there a way to accomplish this? I know you are saying, just don't allow
them access from the user level security, but I think that a different start
form is better for several reasons.

Can anyone help me?
 
I am using user level security just fine, although it took quite a bit of
failure just to become "less nervous" about security.

What I need is for the different user groups to have a different form that
they start with. Teachers would have the frmMainTeacher, adminsitrators,
frmMainAdmin, etc.

Is there a way to accomplish this? I know you are saying, just don't allow
them access from the user level security, but I think that a different start
form is better for several reasons.

Can anyone help me?

Assuming your users belong to only one group other than the Users group (which everyone belongs to), you can do this:

If faq_IsUserInGroup("Teachers", CurrentUser) then
DoCmd.OpenForm "frmMainTeacher
ElseIf faq_IsUserInGroup("Administrators", CurrentUser) Then
DoCmd.OpenForm "frmMainAdmin"
End If

This code would be run in the Load or Open event of a main startup form. You could also do this with a Select Case
statement, which may make more sense, depending on the number of groups and the number of users in multiple groups.

Place this function in a Standard Module somewhere:

Function faq_IsUserInGroup (strGroup As String, strUser as String) As Integer
' Returns True if user is in group, False otherwise
' This only works if you're a member of the Admins group.
Dim ws As WorkSpace
Dim grp As Group
Dim strUserName as string

Set ws = DBEngine.Workspaces(0)
Set grp = ws.Groups(strGroup)
On Error Resume Next
strUserName = ws.groups(strGroup).users(strUser).Name
faq_IsUserInGroup = (Err = 0)
End Function

Code block abvoe From here:
http://support.microsoft.com/default.aspx?scid=/support/access/content/secfaq.asp#_Toc493299691

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
Back
Top