Results 1 to 5 of 5
  1. #1
    hitesh_asrani_j is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    75

    GetUser()

    I have a user form.... it takes two values Username and Password.
    That user name is saved globally using a Module...
    A new form is opened after that UserForm..
    Now it contains a field which takes the value of that Username using that Module with the help of the function =GetUser()

    But wheni try saving that record into a table that particular field shows blank:|



    Can anyone hlp...

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    Textbox ControlSource set to an expression will not save the calculated value. Must use code.

    If the field is in the form's RecordSource and current record is the one that needs the value, simply:
    Me!fieldname = Me.textboxname
    or
    Me!fieldname = GetUser()
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    hitesh_asrani_j is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    75
    Where do write the following code???
    In the Control Source from the properties pane???

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    Need to decide what event to use for the code, such as a button Click or the form Close. On the Event tab choose event and select [Event Procedure]. Double click the ellipses (...) to open the VBA editor. You will be in the procedure. Type code there.

    Here is possible alternative. Use the GetUser() function in the DefaultValue property of textbox. Set textbox ControlSource to the field. New record will populate field with the default value.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    hitesh_asrani_j is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    75
    It solved :d

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

Similar Threads

  1. GetUser method
    By pkstormy in forum Code Repository
    Replies: 7
    Last Post: 11-22-2012, 06:00 PM
  2. =GetUser() Function
    By Desstro in forum Programming
    Replies: 9
    Last Post: 11-02-2010, 09:23 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