How to store only time into MSaccess database?

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.
dejandejanovicAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
AkAlanConnect With a Mentor Commented:
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
 
AkAlanCommented:
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
 
AkAlanCommented:
Forgot the comma
datepart("hh",YourDateField)
0
 
dejandejanovicAuthor Commented:
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
 
dejandejanovicAuthor Commented:
DatePart("h";[YourDateField])

Open in new window


0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.