Results 1 to 4 of 4
  1. #1
    JoaoSousa is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2020
    Posts
    13

    TimeStamp sign off button

    Hello,

    I want to create a traceable/auditable process on our data entries.
    I created a module to do the following -
    Private Sub SaveSlidebtn_Click()



    Globals.Saving "Data Insertion"

    End Sub
    When using the Module

    Public Sub Saving(Activity As String)


    CurrentDb.Execute "INSERT INTO Micro_Analysis (UserName, Activity, TimeStamp) Values ('" & TempVars("UserName").Value & "', '" & Activity & "', Now())"


    End Sub
    This turned out to be a problem as it's not updating already existing entries that users are working on, but creating an entire new one (I create the entries that will be analysed, so all of them will be already existing entries!)
    Click image for larger version. 

Name:	Capture.PNG 
Views:	12 
Size:	50.8 KB 
ID:	42296
    The text boxes in the subform's red square are not enabled to prevent edition from users, and I would like the Save button to write the TempVars("UserName") and Now() on the text boxes if the value is Null.
    I was wandering if there is any command to write the information in a "me.UserNametxt" and "me.QCDate" sort of way.

    TL;DR
    How do I write the data inside that text box which is specific to the entry?

    Also in all tests that I have now Now() hasn't worked a single time! Any tips on how to write the date properly?

    Kind regards

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Date/time uses # as a delimiter ,like strings use: '

    ...Values (#" & now() & "#)"

    for userID:
    sUserID = Environ("Username")

  3. #3
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Try:
    If IsNull(Me.QCDate) Then
    M
    e.QCDate = Now()
    End If

    In the forms AfterUpDate event
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  4. #4
    JoaoSousa is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2020
    Posts
    13
    Quote Originally Posted by Bob Fitz View Post
    Try:
    If IsNull(Me.QCDate) Then
    M
    e.QCDate = Now()
    End If

    In the forms AfterUpDate event
    Hi!

    I ended up doing that code and added
    If IsNull(Me.QCDate) Then
    M
    e.QCDate = Now()
    ME.UserNametxt = TempVars("UserName").value
    End If

    It works wonderfully! Changed the direction a bit, but Now I'll just make the save button to work as
    update refresh* button. It's solved

    Thank you kindly!

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

Similar Threads

  1. Plus Sign Button to Add Additional Text Boxes
    By makivelli in forum Forms
    Replies: 12
    Last Post: 09-14-2018, 07:32 PM
  2. Sign Out and Sign In Student Database
    By jamiers in forum Forms
    Replies: 6
    Last Post: 08-29-2012, 02:03 PM
  3. How to create a Sign out button in access
    By uronmapu in forum Access
    Replies: 12
    Last Post: 07-12-2012, 07:34 PM
  4. Replies: 4
    Last Post: 04-14-2012, 07:22 PM
  5. Replies: 35
    Last Post: 09-19-2011, 10:13 AM

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