Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    May 2002
    Location
    Jerusalem, Israel
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automatic Reports Based on User Name (Access 2000)

    I have a button in my DB that enables a person to look up all records under his name. This is done by way of the Parameter Value dialog box (typing your initials) and a query. I have been asked to make it so that the DB automatically knows who you are by your log-in details (each person must log in with a username and password) so that all you have to do is click one button and a report based on records with your name on it appear.

    I haven't the first clue how to go about this. I would appreciate any ideas, pointers etc for where to start.

    Thanks,

    JoeK

  2. #2
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic Reports Based on User Name (Access 2000)

    (Edited by HansV to make URL clickable - see <!help=19>Help 19<!/help>)

    Sounds like your database table includes a field where the user's initials are stored. If they log onto their Windows computers using the same initials, then you can retrieve those initials using a function found at http://www.mvps.org/access/api/api0066.htm

    However, it's unlikely that they have used their initials as their Windows login ID. If that's the case, then you will need to create a new table that shows the corresponding link between Windows login ID and the user's initials. An administrator would need to maintain that linkage table. You would add the linkage table into the query of your original data, joined by using the Initials field. Then you would use the Windows loginID, as determined by fGetFullNameOfLoggedUser(), from the linkage table as the selection criterion.
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  3. #3
    Star Lounger
    Join Date
    May 2006
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic Reports Based on User Name (Access 2

    If you are using the Access Security, then you might consider using CurrentUser() function to get their Access User Name..

    If not using the Access Security, then you might consider using Environ("UserName") to get their system login name.

    I recently got clarification about those functions a few weeks ago from HansV.

  4. #4
    2 Star Lounger
    Join Date
    May 2002
    Location
    Jerusalem, Israel
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automatic Reports Based on User Name (Access 2

    Thanks for your replies. I am using Access Security. My problem is that I don't know how to get the query to filter according to the username. Do I simply create a query with CurrentUser() as one of the filters? For example, replace the field in which I have the parameter query with "CurrentUser()"?

    Thanks,
    JoeK

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Automatic Reports Based on User Name (Access 2

    If the field you want to filter on contains the usernames used to log into the database, you can use CurrentUser() as criteria in your query.
    If the field contains an indication of the user that is related to, but not equal to the login name, you must use another method, as indocated by Jack (jacksonmacd).

Posting Permissions

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