Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tracking login, logout activity ms access 1

Status
Not open for further replies.

gchikop

Technical User
Feb 22, 2016
2
ID
Hello everyone,

Here i got my work to create a program that has login and logout system. (and also another feature)
I want to do tracking to login and logout system.

So,
If user1 do login, then the system puts the user1 id number and name and create new record. (I used append query)
if user1 do logout, then the system update the record to the user1 record. (I used update query)
then if user2 do login, then the system do the same as the other login.
if user2 logout then same

but, if in another time, user1 do login again, then the system puts the user1 id number and name into new record. (not the same record as before)
and when user1 do logout, the system update its record

How does it work?
i've been googling for my probs, but i got nothing

could someone help me? [bugeyed]
Thanks [thanks]


The table that hold the user log contains :
1. No (as primary key and set to autonumber) -> i think to specify the append and update query
2. ID (the user id number)
3. Account (the user name)
4. Login date (i append this to date())
5. Login time (append as time())
6. Logout date (same as above)
7. Logout time (same as above)

The table could be like this :
No ID Login Date Login Time Logout Date Logout Time
1 user1 23/02/2016 01.00 23/02/2016 02.00
2 user2 24/02/2016 10.00 24/02/2016 12.00
3 user1 24/02/2016 02.00 24/02/2016 05.00
4 user2 25/02/2016 01.00 25/02/2016 02.00
5 user3 25/02/2016 05.00 25/02/2016 05.30
 
Make fields 4 and 5 as one field - DateTime (Login, default value: Now()), make fields 6 and 7 as one field DateTime (Logout).

[pre]
LogTable:

No ID Login Logout
1 user1 23/02/2016 01.00 23/02/2016 02.00
2 user2 24/02/2016 10.00 24/02/2016 12.00
3 user1 24/02/2016 02.00 24/02/2016 05.00
4 user2 25/02/2016 01.00 25/02/2016 02.00
5 user3 25/02/2016 05.00 25/02/2016 05.30
[/pre]

On Login:
'In case User1 crashed last time and never logged out (optional):[tt]
UPDATE LogTable
Set Logout = #1/1/2000#
Where ID = 'User1'
And Logout IS NULL

INSERT INTO LogTable (ID, Login)
VALUES ('User1', Now())[/tt]

On Logout:[tt]
UPDATE LogTable
Set Logout = Now()
Where ID = 'User1'
And Logout IS NULL[/tt]


Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top