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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What happened? Why is IsInGroup case-sensitive? 2

Status
Not open for further replies.

Dor100

Technical User
Apr 9, 2001
279
US
What happened? Since when is the IsInGroup function case- sensitive?

Here's the function:

''''''''''''''''''''
Public Function IsInGroup(UsrName As String, GrpName As String) As Boolean
'Determines whether UsrName is a member of GrpName

Dim grp As Group
Dim IIG As Boolean
Dim usr As User

IIG = False

For Each usr In DBEngine.Workspaces(0).Users
If usr.Name = UsrName Then GoTo FoundUser
Next

GoTo IIG_Exit

FoundUser:
For Each grp In usr.Groups
If grp.Name = GrpName Then IIG = True
Next

IIG_Exit:
IsInGroup = IIG

End Function
''''''''''''''''''''

The "If usr.Name = UsrName" is case-sensitive; so, for instance, if you log in as "mgr" but the login was originally created as "Mgr," instead usr.Name being recognized as equal to UsrName, it goes unrecognized. This is inconsistent with the case-insensitivity of the user name for login purposes.

Also, if you attempt to use the function in a sub, e.g., "If IsInGroup(CurrentUser, "admins") = True," it doesn't return true unless you use a case-sensitive rendition of the group name, i.e., "If IsInGroup(CurrentUser, "Admins")."

Can this all be rendered case-insensitive? Thanks in advance if anyone knows the answer or has a solution.
 
Which Option Compare are you using ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I just did a Ctrl-F for the form module and discovered it's missing.
 
Then it defaults to Binary -> case sensitive string comparision, use Text or Database for case insensitive string comparision.

Roy-Vidar
 
These two friends at home where they belong now:

Option Compare Database
Option Explicit
------------------------------------

Something to look out for now. Thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top