Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Quote Originally Posted by Beetle View Post
    Even though Environ returns a string, in order to apply it to the Default Value property of a control you still need to wrap it in additional string delimiters

    Me!YourTextBox.DefaultValue = """" & Environ("Username") & """"
    That doesn't work either.


    At least not when I tried it
    However this should work

    Add this function to a standard module

    Code:
    Public Function GetUserName()
         GetUserName = Environ("UserName")
    End Function
    Then in the control source or default value for your textbox, enter
    Code:
    =GetUserName()
    Last edited by isladogs; 04-13-2018 at 12:15 PM. Reason: Typos
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  2. #17
    Beetle is offline Unrelatable
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    Camp Swampy (Denver, CO)
    Posts
    207
    That doesn't work either.
    I tested before posting. It does work, at least in my application, so not sure what the difference might be.

  3. #18
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    @anthony

    Can you describe again for clarity what exactly you want for username and password?
    In the Steve Bishop video he uses and application specific login set up.

  4. #19
    anthony@aahs.us is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Apr 2018
    Posts
    14
    Beetle resolved it for me thank you

  5. #20
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Quote Originally Posted by Beetle View Post
    I tested before posting. It does work, at least in my application, so not sure what the difference might be.
    I had tested it by writing the formula you gave direct into the property sheet and that fails.
    It does work if you put it in form load event.

    However if you use a function as I suggested, that will also work in the property sheet.
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. CurrentUser() Macro
    By Helystra in forum Macros
    Replies: 7
    Last Post: 12-09-2013, 10:55 PM
  2. Currentuser always returns "Admin"
    By GraeagleBill in forum Programming
    Replies: 2
    Last Post: 09-21-2013, 02:27 PM
  3. Retrieve the currentuser from Users table (Acc2007)
    By psunilve in forum Programming
    Replies: 3
    Last Post: 04-08-2013, 02:37 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