Results 1 to 3 of 3

Thread: Adding Username to Append Query

  1. #1
    Board Regular gheyman's Avatar
    Join Date
    Nov 2005
    Location
    Orlando, FL USA
    Posts
    1,665
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Adding Username to Append Query

    Is it possible to add the User Name to each record that's being added to a table? I am using an Append Query to add the new record(s). I thought I could create a field in my query to do that, by what I am trying doesn't work

    CreatedBy: Environ("Username")
    G Heyman
    Northrop Grumman - Laser Systems'
    Apopka, FL

  2. #2
    MrExcel MVP
    Moderator
    xenou's Avatar
    Join Date
    Mar 2007
    Location
    Clev. OH, USA
    Posts
    16,492
    Post Thanks / Like
    Mentioned
    12 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Access: Adding Username to Append Query

    Just wrap the vba function in a public function in a module:
    Code:
    Public Function CurrentUser() As String
        CurrentUser = Environ("UserName")
    End Function
    Then use it in your query:
    CreatedBy: CurrentUser()

    Using: Office 2010/Win7 (work) Office 2010/Win7 (home)

    You are rich in proportion to the number of things you can let alone.
    -- Henry David Thoreau

  3. #3
    Board Regular gheyman's Avatar
    Join Date
    Nov 2005
    Location
    Orlando, FL USA
    Posts
    1,665
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Access: Adding Username to Append Query

    Thanks
    Last edited by gheyman; Oct 14th, 2019 at 10:36 AM. Reason: Correction
    G Heyman
    Northrop Grumman - Laser Systems'
    Apopka, FL

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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