7 replies
by c1980
You could create a table that has 2 fields: a User name field and a DateTime field.
The set a macro name "AutoExec" which will start each time the database is opened, that calls, (RunCode), a function, Public Sub UserLogOn(), created by you in a module. This function creates a recordset and opens the above table and adds a new record, setting the UserName field to CurrentUser() and the date field to Now():
rsUser!UserName = =CurrentUser()
rsUser!LogOnTime= =Now()
'===================================
Or make it mor simple Create the tables and in the AutoExec macro add the following 3 commands:
WarnMessages =Off
RunSQL = Insert Into UserLogOn Values (CurrentUser(),Now())
WarnMessages = On
by brian
by donq
by brian
by bob sellman
As noted in the above answers, you must program this capability yourself. I use a standard login form I created that uses data from a UserList table to verify the userID and password. You could create a second table (LoginActivity) that would postthe userID, date/time, activity (logged in or logged out).
Don't forget to also put something in your application that will also post a record to LoginActivity when a user exist the application, otherwise you won't know when they are out of the application. Or you could have two fields: date/time logged in and date/time logged out and post to the one record when the user logs out.
To do more with the User login, create a macro with at least one public variable: strUserID. Post the UserID to strUserID when logging in. You can then control access to different functions based on the UserID (or based on a security level group identified with each user in the user list table). This could also be used if you want to create the trackingdetail capabilities metnioned in the second answer where you post the last userID to change a specific record to that record.
You need to be sure that users do not have access to such things as the X in the control box (upper right corner) of each window/form and can only quit the application one way. Otherwise, they might exit the application in ways that do not post the logged off data.
by brian
by brian
This discussion is closed to new replies.
Trending Software posts
Sort by Trending