• Best way to handle a date field? (Access 2000 SR1)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Best way to handle a date field? (Access 2000 SR1)

    Author
    Topic
    #384432

    This one will probably create a long discussion. I have a ‘normal’ date field that I currently have some code hooked in so that the user can increment and decrement the date using the ‘+’ and ‘-‘ keys. However, I was wondering if there was some way to make the field more generic, so the end user can do more than that – for example, enter the date as a string: Sept 27, 1950 and have it translated into the localized date.

    Localizattion is not a necessity, but it would be nice to have the date more free-form.

    Any ideas?

    Viewing 0 reply threads
    Author
    Replies
    • #659455

      Yes, don’t. Pick a date format like medium date (dd-mmm-yy) and stick with it. That is a generally accepted and understood format pretty much anywhere so there will be no confusion. The user can still enter a date in their local format if you don’t stick some kind of ugly input mask on the field, but the display will be dd-mmm-yy and the underlying field will still be just date/time.

      • #659537

        Thanks! That gave me the best of both worlds. I can let the user enter the dates in multiple formats, and still use the +. -, pgup and pgdn functions like Quicken. It should make things easier for our customers.

        • #659539

          Just one small caution related to Charlotte’s recommendation. If you are likely to be entering dates that are around the default assumption date, then you should probably use a four digit year value. For example if a user wants to enter a person’s birthdate, and it happens to be 1/1/1928, if you enter it in a two digit format, it will be presumed to be 1/1/2028. You can get more details in the help file under “Format Property – Date/Time Data Type”

          • #659627

            Definitely using four digits for the year! Thanks for the tip.

        • #659686

          Be careful of PgUp and PgDown in a bound form. Depending on your form settings, that can move the user to a new or previous record unless you’re trapping the key down events to prevent that.

          • #659733

            Keydown is exactly what I’m trapping. Not only can the user enter the date in numerous formats, but it makes changing the date extremely simple. I was surprised how elegant it makes the app look.

    Viewing 0 reply threads
    Reply To: Best way to handle a date field? (Access 2000 SR1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: