Solved

How to store only time into MSaccess database?

Posted on 2011-03-13
5
352 Views
Last Modified: 2012-05-11
Hello,

I have  an application with Access database. In database I need to query records between ONLY times.
I have in vb.net code on Button_click like this:
OnlyTimeTextBox.text = TimeString

Open in new window

But, when I save record, then database get value like 13.3.2011 19:05:10.

How can I get only time?
My goal is to query like. But, of course it is not working, because the Date is also include.
Between #7:00:00# and #8:00:00#

Open in new window


Thank you in advance for help to anyone.
0
Comment
Question by:dejandejanovic
[X]
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
  • 3
  • 2
5 Comments
 
LVL 6

Expert Comment

by:AkAlan
ID: 35123115
Have you tried using the datepart function

where datepart("hh"YourDateField) BETWEEN #7#  AND #8#

you may have to play with parenthasis and pound sign
0
 
LVL 6

Expert Comment

by:AkAlan
ID: 35123123
Forgot the comma
datepart("hh",YourDateField)
0
 
LVL 6

Accepted Solution

by:
AkAlan earned 500 total points
ID: 35123133
Also, Remember that you are only extracting the Hour part (hh) so don't ask with colons like this #08:00:00#  because it is only looking for integers.
0
 

Author Closing Comment

by:dejandejanovic
ID: 35123322
It works perfect. I could not remember for this solution.
Thank you AkAlan.

This is Access version of the AkAlan code, if someone else maybe need it:
[code]DatePart("h";[YourDateField])[/code]
0
 

Author Comment

by:dejandejanovic
ID: 35123335
DatePart("h";[YourDateField])

Open in new window


0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

627 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