Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB.Net and MS Access problem

VB.Net and MS Access problem

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasehelpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pkrvb
    wrote on last edited by
    #1

    I am trying to use VB.Net as a front end for a MS Access database. I am trying to get the date/time into a format I want to use(displaying, modifying etc). I have the field in Access defined as date/time. I only want to use the time portion in 24hr format. My format is HH:nn:ss and the input mask reflects this. When I display one record in VB.Net, the date is the only thing that is showing and instead of showing today's date, it is showing a date from 30 Dec 1899. The data I already have stored in the Access database for that field is 23:55:00. What do I need to do in order to get it to work the way I would like?

    G T 2 Replies Last reply
    0
    • P pkrvb

      I am trying to use VB.Net as a front end for a MS Access database. I am trying to get the date/time into a format I want to use(displaying, modifying etc). I have the field in Access defined as date/time. I only want to use the time portion in 24hr format. My format is HH:nn:ss and the input mask reflects this. When I display one record in VB.Net, the date is the only thing that is showing and instead of showing today's date, it is showing a date from 30 Dec 1899. The data I already have stored in the Access database for that field is 23:55:00. What do I need to do in order to get it to work the way I would like?

      G Offline
      G Offline
      green2go
      wrote on last edited by
      #2

      You are displaying the date in the text box in the wrong format. You can reformat the date in a textbox like this: Dim MyDate As DateTime = Me.TextBox1.Text Me.TextBox1.Text = MyDate.ToLongTimeString() How did you setup the Dataset, etc? (Wizard or code) There is probably a better way of doing it if you could explain. Green2Go

      P 1 Reply Last reply
      0
      • G green2go

        You are displaying the date in the text box in the wrong format. You can reformat the date in a textbox like this: Dim MyDate As DateTime = Me.TextBox1.Text Me.TextBox1.Text = MyDate.ToLongTimeString() How did you setup the Dataset, etc? (Wizard or code) There is probably a better way of doing it if you could explain. Green2Go

        P Offline
        P Offline
        pkrvb
        wrote on last edited by
        #3

        I set up the dataset through a wizard. The only thing I have coded an event on closing to update the database. Public Class frmSingle Private Sub DataBindingNavigatorSaveItem_Click(ByVal _ sender As System.Object, ByVal e As System.EventArgs) _ Handles DataBindingNavigatorSaveItem.Click Me.Validate() Me.DataBindingSource.EndEdit() Me.DataTableAdapter.Update _(Me.TandemsheetsDataSet.data) End Sub Private Sub frmSingle_FormClosing(ByVal sender As Object, _ ByVal e As System.Windows.Forms.FormClosingEventArgs) _ Handles Me.FormClosing Me.DataTableAdapter.Update _(Me.TandemsheetsDataSet.data) End Sub Private Sub frmSingle_Load(ByVal sender As _ System.Object, ByVal e As System.EventArgs) Handles _ MyBase.Load 'TODO: This line of code loads data into 'the 'TandemsheetsDataSet.data' table. You can 'move, or remove it, as needed. Me.DataTableAdapter.Fill _ (Me.TandemsheetsDataSet.data) End Sub End Class

        1 Reply Last reply
        0
        • P pkrvb

          I am trying to use VB.Net as a front end for a MS Access database. I am trying to get the date/time into a format I want to use(displaying, modifying etc). I have the field in Access defined as date/time. I only want to use the time portion in 24hr format. My format is HH:nn:ss and the input mask reflects this. When I display one record in VB.Net, the date is the only thing that is showing and instead of showing today's date, it is showing a date from 30 Dec 1899. The data I already have stored in the Access database for that field is 23:55:00. What do I need to do in order to get it to work the way I would like?

          T Offline
          T Offline
          TomGarth
          wrote on last edited by
          #4

          Does your format really have "nn", or is that just a typo?

          Tom Garth Developer R. L. Nelson and Associates, Inc., Virginia

          P 1 Reply Last reply
          0
          • T TomGarth

            Does your format really have "nn", or is that just a typo?

            Tom Garth Developer R. L. Nelson and Associates, Inc., Virginia

            P Offline
            P Offline
            pkrvb
            wrote on last edited by
            #5

            It was "nn" because that is what Access used as the minute placeholder in the custom format. Access probably uses it to distinguish from the month for which it uses mm. At least it is working that way. I think I might have found what I am looking for though. In VB on the properties for the textbox I am using, I changed the Format property to Custom and changed the CustomFormat property to HH:mm:ss. It works the way I want it to now. Thanks to Tom and green2go for attempting to help me. :)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups