Link to home
Start Free TrialLog in
Avatar of dejandejanovic
dejandejanovic

asked on

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.
Avatar of AkAlan
AkAlan

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
Forgot the comma
datepart("hh",YourDateField)
ASKER CERTIFIED SOLUTION
Avatar of AkAlan
AkAlan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dejandejanovic

ASKER

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]
DatePart("h";[YourDateField])

Open in new window