A cheap and easy way would be to use global variables in a standard module. One thing to consider is that all declarations in a Standard Module will use memory as soon as your application starts. So, the proper way might be to create a custom, stand alone, class. For a function in a Standard Module maybe ...
Code:
Public gstrFullName As String
Public gstrFirstName As String
Public Function fAdUserInfo() As Boolean
Dim sysInfo As New ADSystemInfo
Dim varUserName As Variant
gstrFirstName = "" 'Default
gstrFullName = "" 'Default
fAdUserInfo = False 'Default
varUserName = sysInfo.UserName
If varUserName > "" Then
Dim oUser As ActiveDs.IADsUser
Set oUser = GetObject("LDAP://" & varUserName & "")
fAdUserInfo = True
gstrFirstName = oUser.FirstName
gstrFullName = oUser.FullName
Else
MsgBox "There was a problem. Unable to continue."
End If
End Function
And then you could have a sub-procedure in a form
Code:
Private Sub Command0_Click()
If fAdUserInfo = True Then
Debug.Print gstrFullName
Debug.Print gstrFirstName
End If
End Sub