Results 1 to 2 of 2
  1. #1
    DCV0204 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    85

    populate field in a form based on user???

    I have a main form that lets say 4 staff enter information; on the form I have a field called "LtrSentBy". When this form opens I would like for this field to be pre-populated based on the user. The field is currently just a text field, but I can make it a combo or list box. What is the best way to accomplish this?
    Thanks,
    Lisa

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    In the on load event for your form, insert the following code.

    Code:
    Dim strValue as String
    strValue = ENVIRON("username")
    me.LtrSentBy.Value = strValue
    This will automatically populate the text field with the windows user name.

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

Similar Threads

  1. Fields populate based on another field
    By jlclark4 in forum Forms
    Replies: 3
    Last Post: 12-27-2011, 05:21 PM
  2. Replies: 3
    Last Post: 10-03-2011, 02:33 PM
  3. Replies: 3
    Last Post: 12-06-2010, 06:35 PM
  4. Replies: 3
    Last Post: 08-25-2010, 09:03 AM
  5. Replies: 3
    Last Post: 10-05-2009, 07:22 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