Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Start-up Options ...

0 views
Skip to first unread message

m.cr...@gmail.com

unread,
Oct 17, 2006, 8:40:41 AM10/17/06
to
Hi folks!

Can anybody tell me if / how I can get the database window to open only
for Administrators at logon?

Obviously users can hold the SHIFT button to override the start-up
options but ideally I would like Administrators to log in, still get
the switchboard but also have access to the database window.

Even if can't be done automatically at start-up, what about a comand
that i can attach to a seperate command button to open it (which i
would make only visible to Admins users)?

Any ideas?

Much appreciated

Brendan Reynolds

unread,
Oct 17, 2006, 8:55:03 AM10/17/06
to

Public Function IsUserInGroup(ByVal GroupName As String) As Boolean

Dim usr As DAO.User
Dim grp As DAO.Group

Set usr = DBEngine.Workspaces(0).Users(CurrentUser)
For Each grp In usr.Groups
If grp.Name = GroupName Then
IsUserInGroup = True
Exit For
End If
Next grp

End Function

Private Sub Command0_Click()

If IsUserInGroup("Admins") Then
DoCmd.SelectObject acForm, Me.Name, True
End If

End Sub

The third, optional argument to the SelectObject method specifies whether
the object should be selected in the database window. Passing a value of
True for this argument, as in the example above, makes the database visible
if it is currently hidden. In the example the code is in the Click event
procedure of a command button, but you could place it in the Open or Load
event of your main menu form or switchboard if you prefer.

--
Brendan Reynolds
Access MVP

<m.cr...@gmail.com> wrote in message
news:1161088841.1...@i42g2000cwa.googlegroups.com...

m.cr...@gmail.com

unread,
Oct 17, 2006, 9:27:12 AM10/17/06
to

Thanks Brendan - it works a treat :-)

0 new messages