Access problem with

Hello. I have an access database linked to my program. When I update a record from my dataset back to the database, a "StartTime" field is being saved with full the format "DDD MMM DD, YYYY HH:MM tt", instead of a time "HH:MM tt" only. I have this datacolumn binded to a textbox within my program. The datatype for the datacolumn for my dataset is "DateTime", I believe this to be the culprit but there are no other options for "Time" or "Medium Time". The format for the field in access is set to "Medium Time", but seems to want to write the entire date and time to the database. Any suggestions, pulling my hair out as this is one of many problems I've encountered while using Thanks in advance for any help!


  • seancampbellseancampbell Pennsylvania, USA
    I think this has to do with the Database's data type. I don't think there is such thing as just a Time object. So when you want to store a time in a Non-string object, you use a DateTime object. DateTime objects store a date and time, but you can use string formatting with VB.Net to extract just the time.

    I use Date Time Objects in VB Like This:
    Dim StartTime as Date = Now

    MsgBox(Format(StartTime, "hh:mm:ss tt"))

    If there is a way to store just the time, not in a nvarchar datafield, I am not aware of it... Curiously, try adding a record from the Access interface, and type just a time in one of the DateTime fields, if it stores just the time, then maybe there is a way. Let me know what happens.

    I am not sure what issue the storing of the date is causing for you, but Date objects in VB are really convenient to work with, so I personally would suggest for you to keep it storing the date time like it is.

    Hope this helps,
    Sean Campbell
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion