Results 1 to 8 of 8
  1. #1
    yrstruly is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2024
    Posts
    107

    Record Logon User & Changes

    Please assist. I would like to implement a user tracking acticivity.


    Use this Access application(https://drive.google.com/file/d/1-WF...ew?usp=sharing) as a test for my tracker activitiy. It should track any changes/activity a user makes after it logon and load data to a form ect.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    Please look at this link /thread and see if it covers what you are describing. Best us of macros

  3. #3
    yrstruly is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2024
    Posts
    107
    I have a VBA code that reads the users details and it should populate a field in a table "CapturedBy". Im getting an error.

    Code:
    Private Sub cmdproceed_Click()    If IsEmpty(Me.User) Then
            MsgBox "Kies eers u naam asseblief."
            Me.User.SetFocus
            Exit Sub
        End If
    
    
        ' Use single quotes around Me.User because [UserID] is a text field
        If Me.Pass = DLookup("[Passw]", "tblUsers", "[UserID] = '" & Me.User & "'") Then
            ' Retrieve and display username from tblUsers
            Me.UserID = Me.User
            Me.Username = DLookup("[UserName]", "tblUsers", "[UserID] = '" & Me.User & "'")
            
            ' Set the global variables
            gUserName = Me.Username
            gUserID = Me.User
    
    
            ' Log the login event
            DoCmd.SetWarnings False
                DoCmd.OpenQuery "qryUserLoggedInAppend", , acViewNormal
            DoCmd.SetWarnings True
    
    
            ' Open additional forms
            DoCmd.OpenForm "frmqryIN_or_Out"
            DoCmd.OpenForm "Switchboard"
            DoCmd.OpenForm "frmRemindersForUser" ' Opens for all users.
            
            Me.Visible = False
            If CurrentProject.AllForms("frmRemindersForUser").IsLoaded = False Then
                ' Form is closed
                Forms!Switchboard.SetFocus
            Else
                ' Form is open
                Forms!frmRemindersForUser.SetFocus
            End If
        Else
            MsgBox "Nie korrek nie. Probeer asseblief weer."
        End If
    End Sub
    ---------------
    Needed for above code to work:
    
    
    Option Compare Database
    Option Explicit
    
    
    Public gUserName As String
    Public gUserID As Long
    modGlobals
    Code for Onload for form:
    Code:
    Private Sub Form_Load()
        If Len(gUserName) > 0 Then
            Me.txtCapturedBy.Value = "Logged in as: " & gUserName
        Else
            Me.txtCapturedBy.Value = "User not identified"
        End If
    End Sub
    
    https://docs.google.com/document/d/1...f=true&sd=true

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,284
    And again you cannot state the error?

    You need to take up another hobby. logic is not for you.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    yrstruly is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2024
    Posts
    107
    Luckily you dont hand out logic...

  6. #6
    yrstruly is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2024
    Posts
    107
    Luckily you dont hand out logic neither do you control me. Simply dont reply, keep your negative comments to yourself.
    Quote Originally Posted by Welshgasman View Post
    And again you cannot state the error?

    You need to take up another hobby. logic is not for you.

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,284
    Hardly negative?
    If you supplied the error, people would be able to help you better.
    However, say hello to my IL.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  8. #8
    madpiet is offline Expert
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    559
    Wouldn't you use a function that grab's the user's network username to do that?

    (One of the things I like about SQL Server... all that stuff is pretty much built in.)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 11-03-2024, 09:50 AM
  2. User access via Logon screen
    By hinchi1 in forum Access
    Replies: 19
    Last Post: 11-05-2023, 03:34 PM
  3. Replies: 7
    Last Post: 03-19-2021, 05:54 PM
  4. Multi User Logon: Check Box = Diffrent Forms
    By Zantox in forum Programming
    Replies: 7
    Last Post: 11-11-2012, 01:01 PM
  5. Replies: 0
    Last Post: 09-27-2011, 12:25 PM

Tags for this Thread

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