Results 1 to 8 of 8
  1. #1
    Helystra is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2013
    Posts
    35

    CurrentUser() Macro

    I am trying to store the username of the last person to modify a record. I have found and implemented the CurrentUser() expression in a "before update" macro, but that only returns the value of Admin. What I really want is the network log in so that I do not need to create a separate log in table and tracking for the users of my database. Is there a different expression that I can use for this?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Options include the Environ() function and:

    http://access.mvps.org/access/api/api0008.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Helystra is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2013
    Posts
    35
    When I put Environ() into the macro in place of CurrentUser() I get an error message saying that it can't find the value. I'm new to Access so I have no coding experience so I'm probably missing some steps or something and will need a little more detail to make it work.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Sorry, I don't use macros. Apparently that function isn't available within one.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Helystra is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2013
    Posts
    35
    ahhh i'm assuming you were offering a VBA solution then? I dont' really know how those work but I'm happy to learn if it gets me the results I'm after.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Here's where it goes:

    http://www.baldyweb.com/FirstVBA.htm

    and the code would look like:

    Me.NameOfControl = Environ("username")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Helystra is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2013
    Posts
    35
    Ok let me see if i have this right. For what I want, I would use the "before update" (rather than on click) and event procedure in the field I want the username to show up in and then type in your code between the Private Sub and End Sub lines as shown in your link...Is that right?

  8. #8
    Helystra is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2013
    Posts
    35
    is there a way to save that so I can use it on more than one form sort of like the way I can save a macro and use it over and over again with just a simple selection of the stored macro?

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

Similar Threads

  1. Currentuser always returns "Admin"
    By GraeagleBill in forum Programming
    Replies: 2
    Last Post: 09-21-2013, 02:27 PM
  2. Retrieve the currentuser from Users table (Acc2007)
    By psunilve in forum Programming
    Replies: 3
    Last Post: 04-08-2013, 02:37 PM
  3. Replies: 0
    Last Post: 01-12-2011, 12:43 PM
  4. CurrentUser()
    By OpsO in forum Access
    Replies: 8
    Last Post: 09-16-2010, 11:37 AM
  5. CurrentUser dependent data in formular
    By Patience in forum Access
    Replies: 1
    Last Post: 05-11-2010, 12:26 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