How to Get the Windows Username in MS Access

Поділитися
Вставка
  • Опубліковано 19 вер 2024
  • In this episode, we're going to learn how to get the Windows username for our Microsoft Access application, so that users can be greeted and also to allow us to log certain user actions in our database for administrative purposes. This is a very handy skill for any MS Access developers to learn as it can improve your user's experience and help your logging processes. We'll take a look at two different ways to get the Windows username with the attached domain, so that you can choose which is better for your application.
    Related Videos:
    How to disable and enable the Bypass Key on your MS Access app so users cannot bypass Autoexec/Forms
    • How to disable and ena...
    Link and Relink Your Access Front-End App Using vbScript and a Table-Based Approach
    • Link and Relink Your A...
    How to Use vbScript to Relink Your User's MS Access Application Front-End Automatically
    • How to Use vbScript to...
    Use vbScript to Deploy your Access Front End, Create Shortcuts, and Check for Updates on User Login
    • Use vbScript to Deploy...
    How to Encrypt and Hash Passwords in MS Access
    • How to Encrypt and Has...
    How to Encrypt Sensitive Data in Microsoft Access
    • How to Encrypt Sensiti...
    How to Kick Users out of Your MS Access Database
    • How to Kick Users out ...
    How to Get the IP Address in Microsoft Access
    • How to Get the IP Addr...
    How to Get the Windows Username in MS Access
    You are watching this video now!
    How to Set Basic Startup Options on Your Microsoft Access Database
    • How to Set Basic Start...
    Join me on Patreon!
    / mackenziedataengineering
    Demo of my BZ RDP Cloaker:
    www.patreon.co...
    Check out some tech (and support my channel!):
    www.amazon.ca/...
    Want the code from this video?
    mackenziemacken...
    Interested in transforming your career or finding your next gig?
    system.billzon...
    Want my team to do a project for you? Let's get to it!
    system.billzon...
    Contact form you can find at www.mackenziema...
    Follow me on social media:
    / mackenziedataanalytics
    / seamacke
    / seamacke
    / seamacke
    / psmackenzie
    Get Microsoft Office including Access:
    click.linksyne...
    Got a UA-cam Channel? I use TubeBuddy, it is awesome. Give it a try:
    www.tubebuddy....
    #msaccess #vba

КОМЕНТАРІ • 27

  • @RugbyNo17
    @RugbyNo17 Рік тому +2

    This is fantastically useful stuff (like all of your videos). I'd like to request a video on how to obtain a user's email address from the GAL in Outlook if you would. Keep on doing what you do, it's EXTREMELY helpful to a rookie Access developer like me. 😎

  • @jupiter2479
    @jupiter2479 11 місяців тому +1

    You’re a life saver
    Thank you

  • @hassanrozh6579
    @hassanrozh6579 Рік тому +1

    Thanks so much, great video.

  • @siclucealucks
    @siclucealucks Рік тому +1

    Great excactly I was waiting for

  • @interestingamerican3100
    @interestingamerican3100 Рік тому +2

    Thank you!!! I was wanting to learn this.

  • @jerzykepinski
    @jerzykepinski Рік тому +1

    Thanks, this was good!

  • @gerfer6261
    @gerfer6261 Рік тому +1

    1-Handy hint. I have being using second option = environ variable with computer name
    2-Any trick to get the Full name than the login name!!!! Or user email address
    3-User logger also very handy I get login time and log off time
    4- Could not find it in the Download page appreciate if you add it so that I could get it into my collection
    As always appreciate your knowledge base contribution
    Cheers 🏃🏽

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  Рік тому

      Thanks for the feedback! The downloads page has been updated. Getting more information about the user is possible through a LDAP query if you're in a domain, but that is another function that we will have to explore in another video. I'll add it to my list. cheers

  • @lorimartin3760
    @lorimartin3760 29 днів тому +1

    Thank you for posting this, it was exactly what I was looking for! I am running into an error where if the user deletes their name the form gives an error message "Update or Cancel/Update w/out Add/New or Edit" is there anyway to make this stop coming up? I am using your code to autofill in who made a change on a line, but it may get filled in in error. I have the code on the "On Lost Focus" event. Any help would be greatly appreciated, thanks!

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  27 днів тому

      Glad it worked for you! Yes, you can go to the properties of the text box under data and set the Locked property to Yes and it will stop them from editing/removing their name. You can also set Enabled to No (this will grey it out though).

  • @shafiqueahmad9024
    @shafiqueahmad9024 Рік тому

    wow. cool solution.
    Sir please make a video on COM control in access. how get data into a table from COM PORT.

  • @mostafamahmoud6803
    @mostafamahmoud6803 Рік тому +1

    thanks for the video , it was really great , can you please show how to get the ip address for the device of the user ?

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  Рік тому

      You can use a function like this to get the IP:
      Function IpAddress()
      Dim objNics, objNic, strIP, strComputer, strIps
      Set objNics = GetObject("winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration")
      For Each objNic in objNics
      if objNic.IPEnabled then
      strIP = objNic.IPAddress(0)
      If Len(strIps) > 0 Then strIps = strIps & ","
      strIps = strIps & strIP
      End if
      Next
      IpAddress = strIps
      End Function
      To use it, load your variable:
      strIp = IpAddress()
      MsgBox strIP
      or do what you want with it!

  • @abedalil8739
    @abedalil8739 Рік тому +1

    Can you get Windows Password like Username ?!!🙂

  • @alessiosonis981
    @alessiosonis981 6 місяців тому +1

    I can imagine that this "function" could be used when closing the mask! @seanmackenziedataengineering

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  6 місяців тому +1

      Thanks for sharing!

    • @alessiosonis981
      @alessiosonis981 6 місяців тому +2

      @@seanmackenziedataengineering I took this tutorial and the one "How to Kick Users out of Your MS Access Database" because I would like to create a log file of accesses and exits from the database. Obviously I divided the DB into FE and BE. Am I on the right track? ps: i follow you from Italy!

    • @seanmackenziedataengineering
      @seanmackenziedataengineering  6 місяців тому +1

      @@alessiosonis981 You bet! You can use this one ua-cam.com/video/Rqhlr6NwUu8/v-deo.html to log the time a form is closed.