• Log Users

    Author
    Topic
    #352813

    Is there some way to create an external to Access file, or internal table, that logs access to a database? I would be interested in who is logging on and when, if that is possible. Is there some way to leverage the LDB file to do this, so that a log of users voer time can be developed?

    This would be a on a database with simple password security.

    Viewing 6 reply threads
    Author
    Replies
    • #514327

      This seems simple enough. Specify a form in Tools Startup in ADD mode. Get the user to enter username and password and bind the username field to a table. You could also include a date/time.

      Check the password and then close the box and open the first form you want the user to have access to.

      • #515199

        Thank you, Grugeon, I used your suggestion and it is exactly what I needed. Very simple and straight forward.

    • #514330

      How about this one:
      Specify in the Startup dialog a form to start up with.
      Ensure the form keeps hidden.
      In the on load event of the form capture the username, preferebly the network user name, and write that with any information you want to an external file or a table.
      Put a timer on the form (1 second should be enough) and close the form with the timer.

    • #514335

      Are you interested in just when the user logs on or the duration of use of the DB? If you want the duration you may wish a hidden form that opens after start and uses the unload event to mark the session end.

    • #514353

      Yes, there’s a way to get the NT User id (I’ll dig the code out of one of my databases if you want it), but not by using environ(9). All eviron(9) gives me is “NUMBER_OF_PROCESSORS=1”. I see from the on-line help that what environ(9) gives is simply the 9th string in the environment string table. Doesn’t sound too reliable for getting something expected!

    • #514360

      I don’t know where I got the following module, but it’s worked for me with Access ’97 and Windows ’95 ’98 and 2000 hope it’s useful:
      Option Compare Database
      Option Explicit

      ‘ Objects for GetUserName_TSB()
      Declare Function TSB_API_GetUserName Lib “advapi32.dll” _
      Alias “GetUserNameA” (ByVal lpBuffer As String, nSize As _
      Long) As Long

      Function GetUserName_TSB() As String
      ‘ Comments : Retrieves the name of the user logged into Windows
      ‘ Parameters: none
      ‘ Returns : string user name

      Dim lngLen As Long
      Dim strBuf As String

      Const MaxUserName = 255

      strBuf = Space(MaxUserName)

      lngLen = MaxUserName

      If CBool(TSB_API_GetUserName(strBuf, lngLen)) Then

      GetUserName_TSB = Left$(strBuf, lngLen – 1)
      Else

      GetUserName_TSB = “”
      End If

      End Function

      • #514451

        You got it from either the Total Access Sourcebook or the Total VB Sourcebook (or whatever they’re calling the combined version now), which is available at a fairly steep price from FMS, Inc.

    • #514392

      Well, I eventually got to “USERNAME=DMartin” with environ(23) ! It does not look as though environ(number) is a very portable way to do anything, since it depends on a lot of things showing up in the same order every time.

    • #514450

      And now the place where you can find the code to get the username: the good old Access Web of course!
      http://www.mvps.org/access/api/api0008.htm

    Viewing 6 reply threads
    Reply To: Log Users

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: