How to calculate login time


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: How to calculate login time

  1. #1
    Join Date
    Nov 2013
    Posts
    1

    How to calculate login time

    Hello

    I have a MS Access 2007 table which I use it to store login and logout information. I want to build a query to calculate for each user the login time. The users may login and logout several times and even in different days when working in shifts that start at the end of the day and logout in the next day for example someone may login at 11:10 PM and logout at 04:00 AM.

    The table named empLogins has the following structure:

    ---------------------------------------------------------------------------------------------------
    | Time of Event | Position| User | Event |
    ---------------------------------------------------------------------------------------------------
    | 01/11/2013 11:15:55 PM | 12 | User1 | Logged_in |
    ---------------------------------------------------------------------------------------------------
    | 01/11/2013 11:20:55 PM | 12 | User3 | Logged_out |
    ---------------------------------------------------------------------------------------------------
    | 01/11/2013 11:55:44 PM | 12 | User1 | Logged_out |
    ---------------------------------------------------------------------------------------------------
    | 01/11/2013 11:56:44 PM | 12 | User2 | Logged_in |
    ---------------------------------------------------------------------------------------------------
    | 02/11/2013 02:31:41 AM | 13 | User2 | Logged_out |
    ---------------------------------------------------------------------------------------------------
    | 02/11/2013 02:31:41 AM | 13 | User3 | Logged_in |
    ---------------------------------------------------------------------------------------------------
    | 02/11/2013 04:58:42 AM | 12 | User2 | Logged_out |
    ---------------------------------------------------------------------------------------------------
    | 02/11/2013 12:19:36 AM | 12 | User1 | Logged_out |
    ---------------------------------------------------------------------------------------------------
    | 02/11/2013 12:19:36 AM | 12 | User3 | Logged_in |
    ---------------------------------------------------------------------------------------------------
    | 02/11/2013 01:15:55 AM | 12 | User1 | Logged_in |
    ---------------------------------------------------------------------------------------------------
    | 02/11/2013 01:15:55 AM | 12 | User3 | Logged_out |
    ---------------------------------------------------------------------------------------------------
    | 02/11/2013 02:05:44 AM | 12 | User1 | Logged_out |
    ---------------------------------------------------------------------------------------------------
    | 02/11/2013 02:05:44 AM | 12 | User2 | Logged_in |
    ---------------------------------------------------------------------------------------------------
    | 02/11/2013 02:31:41 AM | 13 | User2 | Logged_out |
    ---------------------------------------------------------------------------------------------------
    | 02/11/2013 02:31:41 AM | 13 | User3 | Logged_in |
    ---------------------------------------------------------------------------------------------------
    | 02/11/2013 04:58:42 AM | 12 | User2 | Logged_out |
    ---------------------------------------------------------------------------------------------------
    | 02/11/2013 04:58:42 AM | 12 | User3 | Logged_in |
    ---------------------------------------------------------------------------------------------------
    | 02/11/2013 04:58:43 AM | 13 | User2 | Logged_in |

    What I want to achieve is to calculate the total logged in time for each user within a period of time which may be within a day, week, month etc.

    Could you please help me to build a query for this purpose?
    Thank you in advance for your help.

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Would you be doing this in Access VBA?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. Replies: 11
    Last Post: 10-26-2005, 05:37 PM
  2. Calculate different time
    By Frankie in forum VB Classic
    Replies: 4
    Last Post: 12-08-2001, 04:32 AM
  3. Replies: 1
    Last Post: 04-26-2001, 12:47 PM
  4. How to calculate the time again?
    By John Maker in forum VB Classic
    Replies: 0
    Last Post: 02-07-2001, 01:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center