How to remove time from date/time field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • matt753
    New Member
    • May 2010
    • 91

    How to remove time from date/time field

    Problem: I have a textbox on a form which displays the date dd/mm/yyyy, which is how I want it, but when clicking on it it adds the time to the end, which makes it not meet the requirements of the input mask, so you have to backspace the time before leaving the field.

    I traced it back to the table the form gets that value from, the fields datatype is Date/Time, and the Default Value is "Int(Now()) ". If I could change it to Int(Date()) that would fix the problem, although the message on the right shows up: "This property cannot be modified in linked tables". Is there any way I can change this, or write some code so that every time the field in the form is clicked on it takes off the time portion?

    Thanks
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    This will display the date portion only:
    Code:
    Private Sub Form_Current()
      Me.DateFieldName = Format(Me.DateFieldName, "mm/dd/yyyy")
    End Sub
    Welcome to Bytes!

    Linq ;0)>

    Comment

    • matt753
      New Member
      • May 2010
      • 91

      #3
      Thanks that worked!

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        Glad we could help!

        Linq ;0)>

        Comment

        Working...