How to retrieve User- name and group via VBA???

  • Thread starter Thread starter Norman Fritag
  • Start date Start date
N

Norman Fritag

Hi there,

I would like to retrieve of a secured database the Username and the group
that he / she belongs to, to apply access rights to some button click
events, which are accessing forms that the User Usergroup doesn't have
access to.

Any idea how I would go on about it??

kind regards

Norman f
 
Hi Norman,

Norman said:
I would like to retrieve of a secured database the Username and the
group that he / she belongs to

CurrentUser() will get you the username. Keeping in mind that a user can
belong to more than one group, there are functions in the security FAQ you
can use to retrieve the group information.
http://support.microsoft.com/?id=207793
, to apply access rights to some button
click events, which are accessing forms that the User Usergroup
doesn't have access to.

Instead of applying access rights to the button that opens forbidden forms,
you could just hide the button based on the user/group.
 
(untested)

dim u as user, g as group
set u = dbengine(0).users(currentuser())
for each g in u.groups
debug.print "user "; u.name; " is a member of group "; g.name
next
set u = nothing

HTH,
TC
 
Back
Top