+ Reply to Thread
Results 1 to 18 of 18

Auto populate user Id to the userform

Hybrid View

Chrisb812 Auto populate user Id to the... 12-30-2020, 12:48 PM
LeoTaxi Re: Auto populate user Id to... 12-30-2020, 12:57 PM
Chrisb812 Re: Auto populate user Id to... 12-30-2020, 02:59 PM
Chrisb812 Re: Auto populate user Id to... 12-30-2020, 03:25 PM
Pepe Le Mokko Re: Auto populate user Id to... 12-30-2020, 12:58 PM
LeoTaxi Re: Auto populate user Id to... 12-30-2020, 03:39 PM
Chrisb812 Re: Auto populate user Id to... 12-30-2020, 03:47 PM
LeoTaxi Re: Auto populate user Id to... 12-30-2020, 03:40 PM
LeoTaxi Re: Auto populate user Id to... 12-30-2020, 03:55 PM
Chrisb812 Re: Auto populate user Id to... 12-30-2020, 04:12 PM
Chrisb812 Re: Auto populate user Id to... 12-30-2020, 04:15 PM
LeoTaxi Re: Auto populate user Id to... 12-30-2020, 04:33 PM
Chrisb812 Re: Auto populate user Id to... 12-30-2020, 04:41 PM
LeoTaxi Re: Auto populate user Id to... 12-30-2020, 05:22 PM
Chrisb812 Re: Auto populate user Id to... 12-30-2020, 05:44 PM
Chrisb812 Re: Auto populate user Id to... 12-31-2020, 10:01 AM
Pepe Le Mokko Re: Auto populate user Id to... 12-31-2020, 03:32 AM
LeoTaxi Re: Auto populate user Id to... 01-10-2021, 08:03 AM
  1. #1
    Registered User
    Join Date
    12-06-2020
    Location
    Essex
    MS-Off Ver
    365
    Posts
    29

    Auto populate user Id to the userform

    Hello All

    I'd like some help please.

    I'm slowly developing an Excel workbook with macro's & userforms & various tables, I've managed to add a new form for users to login to the program, when the excel file is opened, the user is presented with a userform to enter his/her user-id & password, which then, in turn, opens the excel file to the home sheet, data is then only available to enter via another userform to update tables.

    Where I need further help is, when the data entry forms open I'd like the current Users ID to automatically show on the userform in a locked textbox (textbox1), so this can then be transferred with the data to the table row being entered, I'm ok with the data transfer-coding, just need some help with the User ID population.

    I'd like the User-ID they use to login using the new login form, not the windows or pc id.

    Thank you in advance.

    Chris

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Auto populate user Id to the userform

    Something like

    otheruserform.textbox1=userform.loginbox
    Kind regards
    Leo

  3. #3
    Registered User
    Join Date
    12-06-2020
    Location
    Essex
    MS-Off Ver
    365
    Posts
    29

    Re: Auto populate user Id to the userform

    Quote Originally Posted by LeoTaxi View Post
    Something like

    otheruserform.textbox1=userform.loginbox
    Kind regards
    Leo
    Hi Leo

    Thank you for your reply, this is perfect, great response.

    Chris

  4. #4
    Registered User
    Join Date
    12-06-2020
    Location
    Essex
    MS-Off Ver
    365
    Posts
    29

    Re: Auto populate user Id to the userform

    Hello Leo

    The code works great, but i just noticed that when the user presses the Clear Button, the User-Id clears from the screen along with the rest of the form, is there a bit of code i can add to the Command Button "Clear" not to clear the User-Id "Textbox1"

    Private Sub ClearStockControl_Click()
    
    Unload Me
    
    StockControl.Show
    
    End Sub

    Thanks in Advance
    Chris
    Last edited by Chrisb812; 12-30-2020 at 03:27 PM.

  5. #5
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,605

    Re: Auto populate user Id to the userform

    Administrative note

    Welcome to the forum

    in your haste to solve your problem, you probably missed the yellow banner advising how to get answers faster by posting a sheet ?

    Please take a moment to read it and attach a sheet accordingly.

    Thanks you for helping us help you

  6. #6
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Auto populate user Id to the userform

    i have to see this code that do the clear

    kind regards
    Leo

  7. #7
    Registered User
    Join Date
    12-06-2020
    Location
    Essex
    MS-Off Ver
    365
    Posts
    29

    Re: Auto populate user Id to the userform

    Quote Originally Posted by LeoTaxi View Post
    i have to see this code that do the clear

    kind regards
    Leo
    ok mate, It's the code i posted above

    Private Sub ClearStockControl_Click()
    
    Unload Me
    
    StockControl.Show
    
    End Sub

  8. #8
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Auto populate user Id to the userform

    or like Pepe said, post your file

    cheers
    Leo

  9. #9
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Auto populate user Id to the userform

    Maybe

    Private Sub ClearStockControl_Click()
    dim mstring as string
    mstring=textbox1
    Unload Me
    
    StockControl.Show
    StockControl.textbox1=mstring
    
    End Sub

  10. #10
    Registered User
    Join Date
    12-06-2020
    Location
    Essex
    MS-Off Ver
    365
    Posts
    29

    Re: Auto populate user Id to the userform

    Quote Originally Posted by LeoTaxi View Post
    Maybe

    Private Sub ClearStockControl_Click()
    dim mstring as string
    mstring=textbox1
    Unload Me
    
    StockControl.Show
    StockControl.textbox1=mstring
    
    End Sub
    That don't seem to work, i'll attach a copy of the file

  11. #11
    Registered User
    Join Date
    12-06-2020
    Location
    Essex
    MS-Off Ver
    365
    Posts
    29

    Re: Auto populate user Id to the userform

    Thanks in advance
    Chris
    Last edited by Chrisb812; 12-30-2020 at 05:44 PM.

  12. #12
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Auto populate user Id to the userform

    need also username and login

  13. #13
    Registered User
    Join Date
    12-06-2020
    Location
    Essex
    MS-Off Ver
    365
    Posts
    29

    Re: Auto populate user Id to the userform

    Quote Originally Posted by LeoTaxi View Post
    need also username and login
    sorry mate, use: admin, admin

  14. #14
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Auto populate user Id to the userform

    Never good to unload the form to clear so replace code for clear button

    Private Sub ClearCradles_Click()
    VinNumber = ""
    VehicleMake.ListIndex = -1
    StockLocation.ListIndex = -1
    DateIn = ""
    VehicleType.ListIndex = -1
    GeoReference = ""
    DateOute = ""
    PodReference = ""
    ReceivingDealer.ListIndex = -1
    Notes = ""
    EnterDate = ""
    CradleType.ListIndex = -1
    Reference = ""
    CradlesIn = ""
    CradlesOut = ""
    DistInvNo = ""
    StorageInvNo = ""
    CheckedDate = ""
    CheckedBy.ListIndex = -1
    End Sub
    Kind regards
    Leo
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    12-06-2020
    Location
    Essex
    MS-Off Ver
    365
    Posts
    29

    Re: Auto populate user Id to the userform

    perfect, thanks again Leo
    Last edited by AliGW; 12-31-2020 at 10:02 AM. Reason: PLEASE don't quote unnecessarily!

  16. #16
    Registered User
    Join Date
    12-06-2020
    Location
    Essex
    MS-Off Ver
    365
    Posts
    29

    Re: Auto populate user Id to the userform

    Hello Leo

    Been doing some testing today and came across a problem with the user-ID, it populates when the program opens and use the userform to enter the first record (row of data), but then the User-ID disappears from the Textbox as the sheet is updated? the only way to get the User-ID back is to close the program and log back in, any suggestions?

    Thanks in advance
    Chris

  17. #17
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,605

    Re: Auto populate user Id to the userform

    Administrative Note:

    Please don't quote entire posts unnecessarily. They clutter threads and make them hard to read.
    Use the "Quick reply" instead
    Thanks

  18. #18
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Auto populate user Id to the userform

    All places where you use this 2 lines

        Unload Me
        StockControl.Show
    you have to replace those 2 lines with
    ClearStockControl=true
    Kind regards
    Leo

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Populate Userform with items in a range so user can edit
    By dsrt16 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 03-30-2018, 11:43 AM
  2. Question 3 of 3 - How can I get my UserForm to populate based on user input?
    By gmr4evr1 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-09-2017, 12:49 AM
  3. [SOLVED] Auto-populate Age in UserForm
    By jennsmith88 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-07-2016, 03:01 PM
  4. Auto populate text box on userform
    By sara1989 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-28-2015, 08:45 AM
  5. [SOLVED] Use vlookup to auto populate a combo box in user forms
    By katieshields in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-06-2014, 09:45 AM
  6. Userform auto-populate text box
    By lengths in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-06-2013, 03:24 PM
  7. Auto populate based on user input
    By lotusblossom in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 01-20-2011, 02:58 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1