Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Override Date Format? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    I have a bound date field on a form called dtmDogDOB

    Format : m/d/yyyy
    Input Mask: 99/99/0000;0;_

    This is a casual date with some of my clients entering full m/d/y, example 3/15/05

    Others want to enter only the year, example 2005 and have the system fill in 1/1/2005, rather than manually entering the mount and day.

    What event and code would I use to accomplish this?

    Thanks, John

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Override Date Format? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    You can't do that with a text box bound to a date field. The Windows routines used to process the entry don't recognize 2005 as a valid date.

    The best solution (IMO) is to educate the users to enter a valid date. If that isn't possible, you must use an unbound text box, and process the entry in the After Update event of the text box. Lots of work...

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Override Date Format? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Good idea

  4. #4
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Override Date Format? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Try this

    <pre>Private Sub dtmDogDOB_Enter()

    If Len(Me.dtmDogDOB & "") = 0 Then
    Me.dtmDogDOB = "01/01/" & Format(Date, "yyyy")
    Me.dtmDogDOB.SelStart = Me.dtmDogDOB.SelLength
    SendKeys "{BackSpace}"
    SendKeys "{BackSpace}"
    SendKeys "{BackSpace}"
    SendKeys "{BackSpace}"
    End If
    End Sub
    </pre>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •