Results 1 to 5 of 5
  1. #1
    NikoTheBowHunter is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2017
    Posts
    58

    Need help updating code for user ID

    I would like to update the following to include the users ID but as I have no coding experience, not sure how that would be done.



    Code:
    Private Sub Notes_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Not IsNull(Text138) Then
    Me.[Notes History] = Format(Date, "mm/dd/yyyy") & " | " & Me.Text138 & "<BR>" & Me.[Notes History]
    Me.Text138 = Null
    End If
    End Sub
    I would like the UserID to come at the end of the notes entered. I'm guessing something would be added after the & and before the break "<BR>" but not sure what. any help that can be offered would be much appreciated.

    cheers,
    niko

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    vUserID = Environ("Username")

  3. #3
    NikoTheBowHunter is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2017
    Posts
    58
    Maybe I'm putting the above in my code wrong as now it wants to erase all the notes I had and nothing is added.

    Code:
    Private Sub Notes_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Not IsNull(Text138) Then
    Me.[Notes History] = Format(Date, "mm/dd/yyyy") & "   |   " & Me.Text138 & vUserID = Environ("Username") & "<BR>" & Me.[Notes History]
    Me.Text138 = Null
    End If
    End Sub

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,545
    Perhaps:
    Code:
    Private Sub Notes_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)If Not IsNull(Text138) Then
    Me.[Notes History] = Format(Date, "mm/dd/yyyy") & "   |   " & Me.Text138 & " " & Environ("Username") & "<BR>" & Me.[Notes History]
    Me.Text138 = Null
    End If End Sub
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    NikoTheBowHunter is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2017
    Posts
    58
    It works! thanks so much Bob!!!

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

Similar Threads

  1. Replies: 1
    Last Post: 07-03-2014, 11:07 AM
  2. Replies: 1
    Last Post: 11-13-2012, 02:27 PM
  3. User Input/Updating Tables Help
    By hawkins in forum Access
    Replies: 3
    Last Post: 06-07-2011, 04:48 PM
  4. Replies: 5
    Last Post: 12-19-2010, 04:40 PM
  5. Replies: 13
    Last Post: 05-18-2010, 01:12 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