Consulting

Results 1 to 4 of 4

Thread: Multiple users and time stamp

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Banned VBAX Newbie
    Joined
    Nov 2023
    Posts
    1
    Location
    Quote Originally Posted by Xenia View Post
    Hello.

    Is there a way to have user and time stamp on a simple access file (*.accdb), that will be used by several users ( 5-6) that will just change and add thing in the file in different locations at the time?

    And actually if it can work this way without loosing info while saving?
    Yes, it is possible to have a user and timestamp on a simple Access file (*.accdb) that is used by multiple users simultaneously. Here's how you can achieve this:
    1. Create a table in your Access database to store the user and timestamp information. Include fields such as "Username," "Timestamp," and any other relevant information.
    2. Use VBA code to capture the current user and timestamp whenever a user makes changes to the database. You can use the "Environ" function to retrieve the username and the "Now" function to get the current timestamp. For example:

    ```vba

    Private Sub Form_BeforeUpdate(Cancel As Integer)
        Dim strSQL As String
        strSQL = "INSERT INTO TableName (Username, Timestamp) VALUES ('" & Environ("USERNAME") & "', _
        #" & Now & "#);"
        CurrentDb.Execute strSQL
    End Sub
    ```
    Replace "TableName" with the actual name of your table.
    Last edited by Aussiebear; 01-21-2025 at 12:56 AM. Reason: Added code tags to supplied code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •