Admin always shows up as a user

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

Guest

Im using the following snipet of code to populate a combo box with a list of
user IDs...

Dim objWorkSpace As Workspace
Set objWorkSpace = DBEngine.CreateWorkspace _("SPECIAL", "AdminUser",
"AdminPassword")
intCount = 0
cmbUserID.RowSource = objWorkSpace.Users(intCount).Name
For intCount = 1 To objWorkSpace.Users.Count - 1
Select Case objWorkSpace.Users(intCount).Name
Case "Creator", "Engine", "admin", "Admin" '***
Case Else
cmbUserID.RowSource = cmbUserID.RowSource & ";" & _
objWorkSpace.Users(intCount).Name
End Select
Next intCount
objWorkSpace.Close
Set objWorkSpace = Nothing


The line of code I've marked with *** is designed to prevent the user from
seeing any userIDs I feel would 'confuse' them (it doesnt take much to
'confuse' my users!)

Despite that line of code a User ID called admin (but not Engine or Creator)
always comes up in the combo box!

Can anyone explain why and how I can get rid of it?

Thanks in advance

Simon
 
Urk! I stopped on the createworkspace. You do not need to create a
worksace, to get the list of current users & groups in the current
workgroup file.

This will do it:

dim u as user
for each u in dbengine(0).users
msgbox u.name
next

I suggest that you rewrite your snippet, then try again.

Note that normal VBA comparisons are case insensitive. You don't need
to check "admin" /and/ "Admin" - either one will do (though for
readability, I always code as if the tests /are/ case sensitive).

HTH,
TC
 
Back
Top