Track Usage

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've created a simple look-up data base that will be placed on our network
and made available to all users. My boss has asked that I track the usage of
the database. Anyone know if there's a way to do this?
 
At the top of one of your modules put this line:
Declare Function API_GetUserName Lib "AdvAPI32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Add this function to the module:
Function GetUserName() As String
' Grabs the current user name logged into the computer.

Dim lngLen As Long
Dim strBuf As String

Const MaxUserName = 255

strBuf = Space(MaxUserName)

lngLen = MaxUserName

If CBool(API_GetUserName(strBuf, lngLen)) Then
GetUserName = Left$(strBuf, lngLen - 1)
Else
GetUserName = ""
End If

End Function

This code will tell you who was logged in and opened the database if you
call the function in you database start page.

e.g.

LogUserName = GetUserName

Then it's just a matter of storing the info into a table. You can also
throw in the date they logged in. If your users log in with coded names,
like ST29374, then you'll need a translation table for your boss.

HTH
Mich
 
Summerville said:
I've created a simple look-up data base that will be placed on our network
and made available to all users. My boss has asked that I track the usage of
the database. Anyone know if there's a way to do this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top