Results 1 to 12 of 12
  1. #1
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Use Current Logged ID in Form (Access 2000 SR_1)

    I have a secured DB. I would like to have the user's ID automatically fill the form when they are adding new records.

    Thanks
    Paul

  2. #2
    2 Star Lounger
    Join Date
    Apr 2003
    Posts
    139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Use Current Logged ID in Form (Access 2000 SR_1)

    Type "CurrentUser()" in the Default Value in Properties for a text box. You can also lock it so that it can't be modified.

    Kindra

  3. #3
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Use Current Logged ID in Form (Access 2000 SR_1)

    Thanks. That was easy!

  4. #4
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Use Current Logged ID in Form (Access 2000 SR_1)

    I too would like to use this, but where does Access get the value for "CurrentUser()"? Thanks!

  5. #5
    2 Star Lounger
    Join Date
    Apr 2003
    Posts
    139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Use Current Logged ID in Form (Access 2000 SR_1)

    You have to set up security through the Security Wizard: Tools - Security - User-Level Security Wizard. You can set up security through there (users, passwords, and privileges) and then you will be prompted when you open Access to enter your username and password. Access will keep that username and store it as a variable. The CurrentUser() function will read that variable and return it.

    Let me know if you need anymore help!
    Kindra

  6. #6
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Use Current Logged ID in Form (Access 2000 SR_1)

    To add to what Kindra wrote, if you don't activate security, you will always get "Admin" as the CurrentUser. You can also activate security manually by simply putting a password on the Admin account using the Tools / Security / User and Group Accounts and selecting the Change Logon Password tab. There are many cases where you would like to track who is making what changes, and security is quite useful in the context, even if you don't need a database completely secured. We have a tutorial on our website that gives you an overview of security, and contains links to a number of useful documents that are more detailed.
    Wendell

  7. #7
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Use Current Logged ID in Form (Access 2000 SR_1)

    If you have not got Access Security set up and you are running on an NT-based network you can retrieve the users log-in name.

    See The Access Web - Get Login Name
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  8. #8
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Use Current Logged ID in Form (Access 2000 SR_1)

    Great--thank you very much!

  9. #9
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Use Current Logged ID in Form (Access 2000 SR_1)

    Wendell: Thank you! That's very handy information!

  10. #10
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Use Current Logged ID in Form (Access 2000 SR_1)

    Matter of fact, we are on an NT-based network. So...I've copied and pasted Dev Ashish's code into a new module. Sorry to be so unfamiliar with this stuff, but...now what?

  11. #11
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Use Current Logged ID in Form (Access 2000 SR_1)

    Kinda depends what you wanted the user name for in the first place! <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>

    I use it for amongst other things:
    - Tracking who is logged in, when and for how long (Big Brother is watching you!)
    - Tracking changes to certain records
    - Error logging to see who is creating certain errors (VERY enlightening!)(especially when you retrieve the machine name as well)

    Hope that gives you an idea or two. <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  12. #12
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Use Current Logged ID in Form (Access 2000 SR_1)

    As Steve notes, you can use it for several things, but you cannot use it to control who can do what to the database. As long as you don't have Access security active, any user that can edit records can also delete tables, forms, reports, modify code - and lots of other fun things. But there are times when you do want to know what PC and user have a database open, preventing you from making changes, compacting and repairing, and so forth, and Access security doesn't help you much with roving users.
    Wendell

Posting Permissions

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