Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to store only time into MSaccess database?

Posted on 2011-03-13
5
Medium Priority
?
354 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
  • 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Loops Section Overview
Suggested Courses
Course of the Month12 days, 18 hours left to enroll

972 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