Results 1 to 10 of 10
  1. #1
    KingOf206 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Seattle
    Posts
    153

    Question Users Login and have there INITIALS "auto filled" when filling out forms


    I have a database where multiple users log in and work in 1 of 2 different forms. The 1st form in for inital data entry where users enter data then senter there intials and save each record. the other form is for QC'ing data that has been entered and they will add addtional data to the form, then enter their intials and save the record.

    How can I make it so that I can have a user once they log in to the database, it will autofill their intials? I have used a dropdown box before but it is not helpful for people who have the same first name intial or worst, the same first and second inital becsaue they end up selecting the wrong intials.


    Is there an easy way to make this happen automatically

    P.S. I do not currently have it set up where I have a login screen, I just have only forms visiable to users when they enter data. I would like some hgudance on the easiest way to go about making this happen (I am just trying to shorten the amount of data entry that gets done).

    Any help would be greatly appreciated!!! Thanks in advance!

  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,969
    You can have users login or grab their username from the network login. Regardless, need a Users info table. Get username from network as criteria to lookup record in Users table. Example:

    DLookup("Initials", "Users", "UserName='" & Environ("USERNAME") & "'")

    I hope there aren't multiple users with the exact same initials.
    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
    KingOf206 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Seattle
    Posts
    153
    And where would I put that code? In each form being used?

    So far I have created the user table like you asked its named 'tblUsers' and the 3 feilds are UserName, User, & Initals. I hope I am on the right track.


    Quote Originally Posted by June7 View Post
    You can have users login or grab their username from the network login. Regardless, need a Users info table. Get username from network as criteria to lookup record in Users table. Example:

    DLookup("Initials", "Users", "UserName='" & Environ("USERNAME") & "'")

    I hope there aren't multiple users with the exact same initials.

  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,969
    Will need some code in every form that you want to automate saving initials. Do the DLookup or alternative I do:

    Form (MainMenu) opens when user opens db and never closes. When form opens grab their initials from table and save in an unbound textbox on form. The initials are then always available for reference by other forms.
    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
    KingOf206 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Seattle
    Posts
    153
    I tried the Dlook up but it appeared as RED when i copied it and put it in my form. I really appreciate your help, but I am unsure what code to actually put in so that It can auto pull the users intials when the form opens. That would be ideal for the field to populate when the user opens the form. How can I acheive this?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,969
    Put it in the form where - in VBA procedure - what procedure? Access does not recognize Environ("USERNAME"). Need VBA code, like:

    Private Sub Form_Open(Cancel As Integer)
    Me.tbxUser = DLookup("Initials", "Users", "UserName='" & Environ("USERNAME") & "'")
    End Sub

    tbxUser is an UNBOUND textbox.
    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.

  7. #7
    KingOf206 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Seattle
    Posts
    153
    Click image for larger version. 

Name:	Untitled.png 
Views:	6 
Size:	98.4 KB 
ID:	11948 Here is a screen shot of where I am trying to put it. I would like this code to work in 2 forms. The "Intial Data Entry" form, and the 'Enter VID & Find Voter" Form. What am i doing wrong?

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,969
    You have a sub within a sub. Delete the Form_Load line and its companion End Sub.
    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.

  9. #9
    KingOf206 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Seattle
    Posts
    153
    Click image for larger version. 

Name:	Untitled.png 
Views:	6 
Size:	101.2 KB 
ID:	11949

    Ok I am getting the same error, even when those lines are gone.... Does this code connect to my tblUsers ??

    Quote Originally Posted by June7 View Post
    You have a sub within a sub. Delete the Form_Load line and its companion End Sub.

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,969
    Use your field and table and textbox names in place of the ones from my example.
    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.

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

Similar Threads

  1. How to use "Auto Save" - no more post loss!
    By Matrix in forum Forum Suggestions
    Replies: 6
    Last Post: 11-30-2023, 06:16 PM
  2. Replies: 1
    Last Post: 02-17-2013, 04:46 PM
  3. Replies: 5
    Last Post: 02-05-2013, 10:57 PM
  4. Replies: 11
    Last Post: 03-29-2012, 02:32 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