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

Active Directory

Status
Not open for further replies.

aajaydee

Technical User
Oct 16, 2005
39
US
I need to compare username in Active directory with username in MS Access
Does any one know of a way to do this?
Any help will be appreciated

Thanx

 
I'm not in an AD domain so I'm guessing at the first bit based on docs!!

'Requires a Reference to the 'Active DS Type Library'.
Dim sysInfo As New ActiveDs.WinNTSystemInfo
dim adUsername As String
adUsername = sysInfo.Username

if trim(adusername) = trim(currentuser) then
' they match
else
' they don't match
end if

currentuser returns the name that the user entered to log in to the Access workgroup. If you have not applied Access workgroup security Currentuser always returns 'Admin' (without the quotes)
 
You can also try taking the VBScript approach to obtain the user name. Something like...

set myuser = createobject("WinNT://<domain>/<user>")

msgbox myuser.name

OR Here is something else along those lines...

Set objNetwork = WScript.CreateObject("WScript.Network")
Set objGroup = GetObject("WinNT://" & objNetwork.ComputerName & "/Users,group")

For Each strArgument in Wscript.Arguments
x = InStr(strArgument,"\")
if X>0 Then
Domain_Name = Left(strArgument,x-1)
Admin_Name = Right(strArgument,Len(strArgument)-x)
DNPath = "WinNT://" & Domain_Name & "/" & Admin_Name

On Error Resume Next
If Not objGroup.IsMember(DNPath) Then objGroup.Add(DNPath)
ON Error Goto 0

End If
Next

Set objGroup = Nothing
set objNetwork = Nothing

I am not saying create a VBscript for this. You can use similar code in your Access/VBA Module.

Gary
gwinn7
 
It's enterprise network and they are using LDAP
 
I have ldap path
<path name="ABRC" value="LDAP://OU=Development,OU=Author Groups,OU=ABRC,OU=Web Ops Security Groups,OU=- Security Groups,OU=ABC - MSG - Network Server Technologies (NST),DC=abc,DC=corp,DC=anheuser-busch,DC=com" />
I need to find list of all user (name and id) from Developer group (OU=Author Groups) in "OU=ABRC" then I would like to store that data into access table for further comparison

Please help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top