Solved

TimeValue Criteria

Posted on 2013-10-31
7
344 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

14 Experts available now in Live!

Get 1:1 Help Now