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.
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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.