Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UserIsMemberOfGroup

Status
Not open for further replies.

scking

Programmer
Jan 8, 2001
1,263
US
For years I've successfully used the subject function to return a boolean yes/no depending on whether CurrentUser was a member of a specific group. Well DAO did some things I'm having trouble replacing and the function is heavily into using the DAO libraries. I know ADOX has User and Group objects so it could potentially be my replacement. Is anyone aware of the public domain code which is written in ADOX to perform this function. I assume someone has tackled it because DAO libraries are no longer distributed on newer computers.

---------------------
scking@arinc.com
---------------------
 
DAO libraries are no longer distributed on newer computers
Really ? Even with Office ?
 
According to the dao360.dll file is distributed with Microsoft XP Service Pack 2 which seems as current as possible. However, as a developer who gets calls from users, there have been a number of instances where their systems didn't have DAO registered and the result is either compile errors or functionality which is not avialable. I don't contact the govt system administrators to determine why. I suppose it could merely be a registry issue. So I'm converting DAO data access, permissions management, property management, and calls to IsUserInGroup which uses DAO and the user/group objects associated with it. This isn't the only reason either; I've got to move to ADO to use disconnected recordsets.


---------------------
scking@arinc.com
---------------------
 
This query, against the mdw database in use, shows the groups in which he belongs. String variable TheUser holds the UuserId.

SELECT DISTINCT MSysAccounts_1.Name FROM (MSysAccounts INNER JOIN MSysGroups ON MSysAccounts.SID = MSysGroups.UserSID) INNER JOIN MSysAccounts AS MSysAccounts_1 ON MSysGroups.GroupSID = MSysAccounts_1.SID WHERE MSysAccounts.name = '" & TheUser & "' and MSysAccounts.FGroup = 0 and MSysAccounts_1.FGroup <> 0;
 
Jerry,

I pasted the SQL into Access 2003 and changed variable TheUser to 'Admin'. The error said Access couldn't find the table. Then I set options to show all system objects and MSysAccounts was not visible. Is this solution based on a specific version of Access? Even if I'm doing this on a test db it will have a default mdw file.

---------------------
scking@arinc.com
---------------------
 

As I said, against the mdw database in use. Since you play with code, open a connection to the mdw database and execute that SQL statement
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top