|
From: iholder on 14 Feb 2005 17:55 I need to tracking log in and log out time of users. My approach is to set up Public variable that store the [UserId], [LogDate],[LogInTime] at the time of intial log in. Add store the [LogOutTime] info at logoff time How can I append this info to another table call "tblLogInTracking". Do I use reecordsets and how? Also will setup Public variables for user info conflict is a multiuser application.
From: Penguin on 15 Feb 2005 00:07 Try this link: http://www.mvps.org/access/general/gen0034.htm On Mon, 14 Feb 2005 14:55:03 -0800, "iholder" <iholder(a)discussions.microsoft.com> wrote: >I need to tracking log in and log out time of users. > >My approach is to set up Public variable that store the [UserId], >[LogDate],[LogInTime] at the time of intial log in. > >Add store the [LogOutTime] info at logoff time > >How can I append this info to another table call "tblLogInTracking". > >Do I use reecordsets and how? >Also will setup Public variables for user info conflict is a multiuser >application. > >
From: George Nicholson on 15 Feb 2005 13:00 Here is what I use. I have a table called sysUsageLog consisting of 5 fields: CurrentTime (PK), UserName, Action, CurrentApp, Comment Usage - During startup: Call UsageLogEntry("Log In", "optional comment here") The fOSUserName function (giving you the user's network ID) can be found at http://www.mvps.org/access/api/api0008.htm One advantage to this approach is that you can easily log any number of User actions: changing a path setting, supplying a password, etc. Another is that if you run into corruption problems, you may get some clues by talking to users who appear to log in but not out. In one case I traced a problem back to a user who was occasionally using TaskManager to kill their Access session because it seemed to hang. I found out what he was doing before it "hung up" and discovered that under certain circumstances I had a very nasty piece of recursive code. If I had waited to store LogIn info until LogOut occurred I would never have had any reason to specifically ask this user about any problems he had experienced and the problem would have been recurring, long-standing and very annoying. In this case the "corruption" was fixed with a compact & repair of the backend, and the "cause" of the apparent hang-up was recoded in 10 minutes. ****************************************** Public Sub UsageLogEntry(strAction As String, Optional varComment As String) ' Adds an entry to table sysUsageLog upon specific events: ' Called from Database Startup (LogIn) ' PreExitRestore (LogOut) ' SupplyPassword (DataMaint) On Error GoTo ErrHandler Dim iAttempt As Integer Dim dtmTime As Date Dim db As DAO.Database Dim rs As DAO.Recordset Set db = CurrentDb Set rs = db.OpenRecordset("sysUsageLog") iAttempt = 0 dtmTime = Now() With rs .AddNew ![UserName] = fOSUserName ![CurrentTime] = dtmTime ![CurrentApp] = Left$(db.Name, 100) ![Action] = strAction If Len(varComment) = 0 Then ![Comment] = CStr(varComment) End If .Update End With rs.Close ExitHere: Set rs = Nothing Set db = Nothing Exit Sub ErrHandler: If rs Is Nothing Then Resume ExitHere End If If iAttempt < 3 Then iAttempt = iAttempt + 1 ' Error may be caused by a duplicate DateTime stamp (PrimaryKey) Wait (1) dtmTime = Now() rs!CurrentTime = dtmTime Resume Else Call ErrorLog(mDocName & ".UsageLogEntry") Resume ExitHere End If End Sub ************************ HTH, -- George Nicholson Remove 'Junk' from return address. "iholder" <iholder(a)discussions.microsoft.com> wrote in message news:8E37329D-C706-4350-9CC3-1AF36755409B(a)microsoft.com... >I need to tracking log in and log out time of users. > > My approach is to set up Public variable that store the [UserId], > [LogDate],[LogInTime] at the time of intial log in. > > Add store the [LogOutTime] info at logoff time > > How can I append this info to another table call "tblLogInTracking". > > Do I use reecordsets and how? > Also will setup Public variables for user info conflict is a multiuser > application. > > >
From: iholder on 23 Feb 2005 16:39 I am not sure how the code is applied. I have a setup screen cal frmStartupScreen. How ddo I apply the code. Does this code track the log out time entry. Last, Can you get the User's full name from the network login. Thank Your "George Nicholson" wrote: > Here is what I use. > I have a table called sysUsageLog consisting of 5 fields: CurrentTime (PK), > UserName, Action, CurrentApp, Comment > > Usage - During startup: Call UsageLogEntry("Log In", "optional comment > here") > The fOSUserName function (giving you the user's network ID) can be found at > http://www.mvps.org/access/api/api0008.htm > > One advantage to this approach is that you can easily log any number of User > actions: changing a path setting, supplying a password, etc. > > Another is that if you run into corruption problems, you may get some clues > by talking to users who appear to log in but not out. In one case I traced > a problem back to a user who was occasionally using TaskManager to kill > their Access session because it seemed to hang. I found out what he was > doing before it "hung up" and discovered that under certain circumstances I > had a very nasty piece of recursive code. If I had waited to store LogIn > info until LogOut occurred I would never have had any reason to specifically > ask this user about any problems he had experienced and the problem would > have been recurring, long-standing and very annoying. In this case the > "corruption" was fixed with a compact & repair of the backend, and the > "cause" of the apparent hang-up was recoded in 10 minutes. > > ****************************************** > Public Sub UsageLogEntry(strAction As String, Optional varComment As String) > ' Adds an entry to table sysUsageLog upon specific events: > ' Called from Database Startup (LogIn) > ' PreExitRestore (LogOut) > ' SupplyPassword (DataMaint) > > On Error GoTo ErrHandler > > Dim iAttempt As Integer > Dim dtmTime As Date > Dim db As DAO.Database > Dim rs As DAO.Recordset > Set db = CurrentDb > Set rs = db.OpenRecordset("sysUsageLog") > > iAttempt = 0 > dtmTime = Now() > With rs > .AddNew > ![UserName] = fOSUserName > ![CurrentTime] = dtmTime > ![CurrentApp] = Left$(db.Name, 100) > ![Action] = strAction > If Len(varComment) = 0 Then > ![Comment] = CStr(varComment) > End If > .Update > End With > rs.Close > ExitHere: > Set rs = Nothing > Set db = Nothing > Exit Sub > ErrHandler: > If rs Is Nothing Then > Resume ExitHere > End If > If iAttempt < 3 Then > iAttempt = iAttempt + 1 > ' Error may be caused by a duplicate DateTime stamp (PrimaryKey) > Wait (1) > dtmTime = Now() > rs!CurrentTime = dtmTime > Resume > Else > Call ErrorLog(mDocName & ".UsageLogEntry") > Resume ExitHere > End If > End Sub > ************************ > HTH, > -- > George Nicholson > > Remove 'Junk' from return address. > > > "iholder" <iholder(a)discussions.microsoft.com> wrote in message > news:8E37329D-C706-4350-9CC3-1AF36755409B(a)microsoft.com... > >I need to tracking log in and log out time of users. > > > > My approach is to set up Public variable that store the [UserId], > > [LogDate],[LogInTime] at the time of intial log in. > > > > Add store the [LogOutTime] info at logoff time > > > > How can I append this info to another table call "tblLogInTracking". > > > > Do I use reecordsets and how? > > Also will setup Public variables for user info conflict is a multiuser > > application. > > > > > > > > >
From: George Nicholson on 25 Feb 2005 12:46 UsageLogEntry is a user-defined function. It should go in a standard (not a form or report or other class) code module. fOSUserName should be treated the same. In the open event of your startupform: Call UsageLogEntry("Log In") In whatever routine closes your database: Call UsageLogEntry("Log Out") HTH, -- George Nicholson Remove 'Junk' from return address. "iholder" <iholder(a)discussions.microsoft.com> wrote in message news:87DFE5C7-21F7-4321-81C9-1BBD0C87EC44(a)microsoft.com... >I am not sure how the code is applied. I have a setup screen cal > frmStartupScreen. How ddo I apply the code. > > Does this code track the log out time entry. > > Last, Can you get the User's full name from the network login. > > > Thank Your > "George Nicholson" wrote: > >> Here is what I use. >> I have a table called sysUsageLog consisting of 5 fields: CurrentTime >> (PK), >> UserName, Action, CurrentApp, Comment >> >> Usage - During startup: Call UsageLogEntry("Log In", "optional comment >> here") >> The fOSUserName function (giving you the user's network ID) can be found >> at >> http://www.mvps.org/access/api/api0008.htm >> >> One advantage to this approach is that you can easily log any number of >> User >> actions: changing a path setting, supplying a password, etc. >> >> Another is that if you run into corruption problems, you may get some >> clues >> by talking to users who appear to log in but not out. In one case I >> traced >> a problem back to a user who was occasionally using TaskManager to kill >> their Access session because it seemed to hang. I found out what he was >> doing before it "hung up" and discovered that under certain circumstances >> I >> had a very nasty piece of recursive code. If I had waited to store LogIn >> info until LogOut occurred I would never have had any reason to >> specifically >> ask this user about any problems he had experienced and the problem would >> have been recurring, long-standing and very annoying. In this case the >> "corruption" was fixed with a compact & repair of the backend, and the >> "cause" of the apparent hang-up was recoded in 10 minutes. >> >> ****************************************** >> Public Sub UsageLogEntry(strAction As String, Optional varComment As >> String) >> ' Adds an entry to table sysUsageLog upon specific events: >> ' Called from Database Startup (LogIn) >> ' PreExitRestore (LogOut) >> ' SupplyPassword (DataMaint) >> >> On Error GoTo ErrHandler >> >> Dim iAttempt As Integer >> Dim dtmTime As Date >> Dim db As DAO.Database >> Dim rs As DAO.Recordset >> Set db = CurrentDb >> Set rs = db.OpenRecordset("sysUsageLog") >> >> iAttempt = 0 >> dtmTime = Now() >> With rs >> .AddNew >> ![UserName] = fOSUserName >> ![CurrentTime] = dtmTime >> ![CurrentApp] = Left$(db.Name, 100) >> ![Action] = strAction >> If Len(varComment) = 0 Then >> ![Comment] = CStr(varComment) >> End If >> .Update >> End With >> rs.Close >> ExitHere: >> Set rs = Nothing >> Set db = Nothing >> Exit Sub >> ErrHandler: >> If rs Is Nothing Then >> Resume ExitHere >> End If >> If iAttempt < 3 Then >> iAttempt = iAttempt + 1 >> ' Error may be caused by a duplicate DateTime stamp (PrimaryKey) >> Wait (1) >> dtmTime = Now() >> rs!CurrentTime = dtmTime >> Resume >> Else >> Call ErrorLog(mDocName & ".UsageLogEntry") >> Resume ExitHere >> End If >> End Sub >> ************************ >> HTH, >> -- >> George Nicholson >> >> Remove 'Junk' from return address. >> >> >> "iholder" <iholder(a)discussions.microsoft.com> wrote in message >> news:8E37329D-C706-4350-9CC3-1AF36755409B(a)microsoft.com... >> >I need to tracking log in and log out time of users. >> > >> > My approach is to set up Public variable that store the [UserId], >> > [LogDate],[LogInTime] at the time of intial log in. >> > >> > Add store the [LogOutTime] info at logoff time >> > >> > How can I append this info to another table call "tblLogInTracking". >> > >> > Do I use reecordsets and how? >> > Also will setup Public variables for user info conflict is a multiuser >> > application. >> > >> > >> > >> >> >>
|
Next
|
Last
Pages: 1 2 Prev: Fill fields automatically Next: Repost - Hyperlinks and RunTime Errors |