al4629740
asked on
converting SQL time format for DTPicker field
I have a column in an SQL table with datatype time(7). When I try to place that value into a VB6 DTPicker control, however it doesn't take it. What format do I need to convert to in order to get it into the VB6 form field and how do I convert it in sql properly?
ASKER
I still get Type Mismatch error. Any ideas?
DTPicker = CDate(rec!HourTimeFrom)
ASKER
Ive also tried this below and it yields invalid property value
AddCYEPHours.DTPicker.Value = CStr(Format$(rec!HourTimeto, "hh:mm AM/PM"))
What does the data look like?
Do you have Dtpicker set up to show time? if so this seems to work.
Const S = "09:00:00.0000000"
DTPicker1.Value = Left(S, 8)
You would of course not use the Const but rather your variable.
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes indeed that works. Thank you.
You’re welcome and I’m glad I was able to help.
If you expand the “Full Biography" section of my profile you’ll find links to some articles I’ve written that may interest you.
Marty - Microsoft MVP 2009 to 2017
Experts Exchange Most Valuable Expert (MVE) 2015, 2017
Experts Exchange Top Expert Visual Basic Classic 2012 to 2019
Experts Exchange Top Expert VBA 2018, 2019
Experts Exchange Distinguished Expert in Excel 2018
If you expand the “Full Biography" section of my profile you’ll find links to some articles I’ve written that may interest you.
Marty - Microsoft MVP 2009 to 2017
Experts Exchange Most Valuable Expert (MVE) 2015, 2017
Experts Exchange Top Expert Visual Basic Classic 2012 to 2019
Experts Exchange Top Expert VBA 2018, 2019
Experts Exchange Distinguished Expert in Excel 2018
Try converting to a date:
Open in new window
Else, can your post you source code ?