Solved

Find personnel logged in on a given day

Posted on 2014-09-03
6
154 Views
Last Modified: 2014-09-10
I have a table that has controller login and logout times.
Format is General Date (9/3/2014 12:20:18 PM)
I am trying to design a query that asks  for a date [date?] and then returns anyone logged in that date. (between 00:00 and 23:59 that date)

Here's the catch.  
I might come to work at 8pm (LOGIN:  9/2/2014 20:00:00) and stay until 4am (LOGOUT: 9/3/2014 04:00:00).

when I get the date? prompt, I want to be able to type 9/3/2014 and have it return the login above.   Same return if I ask for 9/2.   Showing the login and logout time crossing the day.

So, for example, I get the date? prompt and type 9/2/14, I want:

Smith, 9/2/2014 08:00:00, 9/2/2014 08:00:00
Doe, 9/2/2014 20:00:00, 9/3/2014 04:00:00


and if I type 9/3/14, I also want:
Jones, 9/3/2014 09:14:00, 9/3/2014 08:00:00
Doe, 9/2/2014 20:00:00, 9/3/2014 04:00:00
0
Comment
Question by:TIgerV
6 Comments
 
LVL 5

Expert Comment

by:Jan Louwerens
ID: 40301870
Something like:

SELECT * FROM <Table> WHERE
   Login < <date_plus_1_day> AND
   Logout >= <date>
0
 

Author Comment

by:TIgerV
ID: 40301902
<date_plus_1_day>

How do I tell the query <date_plus_1_day>?
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 40301919
Or you could use something like:

SELECT * FROM yourTable
WHERE DateValue([Login]) = [Enter date (mm/dd/yy)]
OR DateValue([LogOut]) = [Enter date (mm/dd/yy)]
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 30

Expert Comment

by:hnasr
ID: 40301957
Try:
SELECT * FROM tbl
WHERE [selectedDate] BETWEEN LOGIN AND LOGOUT
0
 
LVL 5

Expert Comment

by:Jan Louwerens
ID: 40302103
It looks like Access has a DateAdd function:
DateAdd("d", 1, <date>)

Open in new window

0
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 40303247
This should do:

SELECT *
FROM tblYourTable
WHERE [Date?] BETWEEN INT(LOGIN) AND LOGOUT

The trick is that Int cuts the time part, thus makes 9/2/2014 08:00:00 to match an input of 9/2/2014.

/gustav
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now