Page 2 of 2 FirstFirst 12
Results 16 to 27 of 27
  1. #16
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    PMFJI, but I recall another user having issues with Martin Green's audit routine. In her case it was the ability to use subforms, but she also noted that wrong record was being recorded when deleting a record. The thread is quite long but may offer some insight. We built a workaround to get an audit trail working for her project. There may be other posts/threads/forums offering a solution to Martin's audit because it has been mentioned as having issues over the years.


    Good luck with your project.

  2. #17
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Quote Originally Posted by pbaldy View Post
    No, this line from the last post linked to in post 11 gave my name rather than login name:

    sUser = objUser.DisplayName
    Paul...Where do I place the code? Do I replace
    Code:
    strUserID =Environ("USERNAME")

  3. #18
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I'd probably create a public function in a standard module. That way you can call it from anywhere and get the name.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #19
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Quote Originally Posted by pbaldy View Post
    I'd probably create a public function in a standard module. That way you can call it from anywhere and get the name.
    I have this code:
    Code:
    Sub Username()
    Set objAD = CreateObject("ADSystemInfo")
    Set objUser = GetObject("LDAP://" & objAD.Username)
    strDisplayName = objUser.DisplayName
    MsgBox strDisplayName
    End Sub
    Still only gets me the UserID

  5. #20
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    For me it gets the Display Name from Active Directory. Try this, in case yours is the same:

    strDisplayName = objUser.FirstName & " " & objUser.LastName

    If that doesn't work, are you in a domain?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #21
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    I'm getting errors from my code above: first "objAD" "objUser" and object not defined. then when I defined them as string Dim objAD as string; compiled error Invalid qualifier...I guess I'm not using the code correctly..I'm putting it in the Public function as you suggested.

  7. #22
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Here's my test function:

    Code:
    Public Function GetUserName() As String
        Dim objAd                 As Object
        Dim objUser               As Object
        Dim strUser               As String
    
    
    
    
        Set objAd = CreateObject("ADSystemInfo")
        Set objUser = GetObject("LDAP://" & objAd.UserName)
        'strUser = objUser.DisplayName
        strUser = objUser.FirstName & " " & objUser.LastName
        GetUserName = strUser
        MsgBox strUser & " " & Environ("username")
    
    
    End Function
    The message box is just for testing.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #23
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    I'm not at work on the AD Domain...I'll have to wait for tomorrow but would like the correct code to try...Thanks

  9. #24
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Thanks....I'll post back tomorrow from work!

  10. #25
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help! That worked for me on a domain; didn't try it at home.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #26
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Gm Paul.. the code u gave me works. I appreciate all ur help!!

  12. #27
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No problem, all I did was steal the code from that link.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Audit Trail Help
    By HelpDesk in forum Access
    Replies: 9
    Last Post: 08-07-2015, 06:13 AM
  2. Having an audit trail
    By ryanmce92 in forum Modules
    Replies: 5
    Last Post: 06-03-2015, 02:29 PM
  3. Replies: 2
    Last Post: 02-09-2013, 12:39 PM
  4. Audit Trail
    By bigroo in forum Programming
    Replies: 4
    Last Post: 02-22-2012, 07:55 PM
  5. audit trail
    By slimjen in forum Forms
    Replies: 1
    Last Post: 10-13-2011, 01:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums