Logging users who open & close a database

andrewf10

Registered User.
Local time
Today, 20:15
Joined
Mar 2, 2003
Messages
114
I know something similar to this has been posted loads of times before but I I can't find an answer that would be suitable for my DB.

Basically I would like to have a table called tblLogUsers, which has 3 fields called 'User', 'DateLogon'' and 'DateLogoff', to be populated when a user logs on and off the database.

Am I trying to get too much from Access? Please let me know your thoughts on possible solutions.
 
This is easy enough. Are you on a network? If you are on a network you can have Access look for the user's lan id and record that alone with the current date and time using code. Then when the user leaves the database, make the timeout = to the current date and time.

Let me know if you have trouble setting something like this up. You can search the forum to fine examples on finding the users lan ID. If you can's use the Lan ID, you could create your own id-table where the user has to choose their login name before they can access the database.

Let me know if that helps,

Vassago
 
Thanks Vassago.

Yes I'm using the DB on a network and I've set up the standard Access user-level security. I was thinking of using the CurrentUser and CurrentDate methods which seems to be half working.

Pointers in the right direction would be much appreciated because my knowledge of VBA isnt the best.
 
I threw this together for you really quick. It is an actual peice of one of my databases, only including my Time Card feature. This will give you some idea how to set up your tables, and will give you the code you need to accomplish this. Let me know if you have any other quesions.

Vassago
 

Attachments

Vassago, you're code was still too complicated for me but many thanks for some other ideas I pinched from it.

So here's where I'm at. OK its not pretty but it seems to be working well enough so far.

Open the database and then open 'frmHomepage', wait a few seconds and then click the 'CLOSE THE DATABASE' command button.

Then reopen the database and open the 'tblLogUsers' table and you'll see the logon and logoff dates and times. Still needs lots of testing but it's a start.

But, as ever there's a drawback.
The Close button is still in the bar at the very top of the screen and File...Exit is still available.

I will be disabling the close button on the form, making the form modal and running as few menus as possible but I'm still relying on user discipline. A lack of user discipline is why I'm going to all this trouble in the first place!
 

Attachments

You're a top man, works like a dream.

I'm going to try out custom-menus as suggested in some previous posts on this site and hopefully that will sort out my last issue.

Thanks again for your help Vassago.

Andrew
 

Users who are viewing this thread

Back
Top Bottom