Get rid of Time in textbox bound to access

Posted on 2006-04-20
Last Modified: 2010-04-23
Hey everyone,

I have a form with a few textboxes that have databindings to an access database. My problem is that the date fields are filling in with the time as well as the date .I want to get rid of the time ...where always comes up 12:00:00 AM . I just want a Date in the format MM/dd/yyyy , i changed the format of the field in access to be short date but i still get the time.

Question by:csakg6s0
    LVL 12

    Expert Comment

    I think you need to use DataBindings properti'es Format method.  I don't have DB engine to test here at home but can do tomorrow at work

    Out of my head just guess try

            Me.TextBox1.DataBindings.Item(0).FormatString = "mm/dd/yyyy"

    in form load must be after you set the databindings for the textbox.  If it dopesn't work and nobody else comes with a solution post a comment tomorrow and I will have a go

    LVL 12

    Accepted Solution

    I could change the textbox text from a button click using

                Me.TextBox1.Text = Format(Me.TextBox1.Text, "mm/dd/yyyy")

    But that cannot be done in the textbox's TextChange event.  events will be recursively raised
    LVL 34

    Expert Comment

    LVL 2

    Expert Comment

    Hello csakg6s0,
             As you are displaying the text in the textbox. You are getting it from the Db whatever it is and then assigning it to the textbox. before assigning the value to the textbox. COnvert the date explicitely to shortdatestring.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now