Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

TimeValue Criteria

Posted on 2013-10-31
7
357 Views
Last Modified: 2013-10-31
Hi all,

I have a query that extracts the Time portion of a date/time field using TimeValue([Field]).

How do I specify the criteria now on that extracted portion to give me only the returned values of 12:00:00AM?

I have tried #12:00:00 AM# and TimeValue("12:00:00 AM") and all i get is data mismatch?

Thanks
Sean
0
Comment
Question by:SeanNij
  • 5
  • 2
7 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 39613771
Try this -

Subtract the integer part of the time, and convert back.

For the current date/time:

cdate(now() - int(now()))
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39613774
Or for a date/time field:


cdate(YourDateTimeField - int(YourDateTimeField))
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39613776
You can also use the Format function:

Format(YourDateTimeField, "hh:nn:ss")
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 1

Author Comment

by:SeanNij
ID: 39613797
I am already extracting the time portion. I want to know what to use in criteria for 12 am.
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39613811
Sorry - I think I totally misread your question.  

Give this a try for criteria to just return records with 12:00:00 AM as the time part:

WHERE TimeValue(YourField) = "12:00:00 AM"


(The where clause in SQL view)
0
 
LVL 1

Author Comment

by:SeanNij
ID: 39613826
HAH! That works!
Thankyou!!!
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39613831
Glad to help out -

Sorry about all the earlier posts.  Need more caffeine.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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 …

856 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