Input mask for date on textbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dopey Fletcher
    New Member
    • Jun 2011
    • 8

    Input mask for date on textbox

    hello All..

    I am currently working on an issue that contains the following

    I have an Access Form on which 2 textboxes are used to let the user select 2 dates. These two dates are used to make a selection. When it starts up, it gives the date in European standard.. (dd/mm/yyyy) but when the user wants to type in another date, the value in the textbox jumps to American date standard (mm/dd/yyyy) How can i make sure that the textbox ALWAYS uses the European standard
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    You may be interested in checking out the topics of Globalization and Localization.

    -Frinny
    Last edited by Frinavale; Jun 13 '11, 03:52 PM.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32633

      #3
      There is a format property of the TextBox control. Assuming you don't have any code that sets the value explicitly (and I'm sure you would have told us if you had) this should ensure the format is consistent.

      Comment

      • Dopey Fletcher
        New Member
        • Jun 2011
        • 8

        #4
        I am using the format property of the TextBox Control, the value of this format property = dd/mm/yyyy. this is the only thing i'm using to se the format. As NeoPa assumed, i am not using any code otherwise

        I made some images of the textbox and will put them here..

        When the form loads the value of the second textbox = current date. This shows correct.
        [IMGNOTHUMB]http://img19.imageshac k.us/img19/9775/datetextbox1.jp g[/IMGNOTHUMB]

        Then I fill in another value, in this example i have used the 12th of May
        [IMGNOTHUMB]http://img148.imagesha ck.us/img148/1499/datetextbox2.jp g[/IMGNOTHUMB]

        So far still good, but when i leave the textbox to click a button or change the value of another textbox, the following shows
        [IMGNOTHUMB]http://img831.imagesha ck.us/img831/1056/datetextbox3.jp g[/IMGNOTHUMB]

        Then when i click the second textbox again, it does show the date in the correct order (so day/month/year) but the leading zero's are removed.
        [IMGNOTHUMB]http://img5.imageshack .us/img5/3639/datetextbox4.jp g[/IMGNOTHUMB]
        Last edited by Niheel; Jun 14 '11, 08:00 AM. Reason: Images weren't displayed, should be fixed now

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32633

          #5
          This is an interesting problem. The answer may be here but it is certainly not obvious to me without the database. If you can, post the database (Attach Database (or other work)) and I'll look at it for you and see if I can determine what the problem is.

          Comment

          • Dopey Fletcher
            New Member
            • Jun 2011
            • 8

            #6
            I'll see if i can post the access application this weekend, it will take some time to clear it of anything that would be useless to you

            Comment

            • aprpillai
              New Member
              • Mar 2008
              • 23

              #7
              Did you check the Date-Format in the Regioonal Settings in Control Panel. You may set the Date format there to match the European format.

              Comment

              • Dopey Fletcher
                New Member
                • Jun 2011
                • 8

                #8
                I just tried it, and at first sight it does seem to work, day and month aren't switched around.. Unfortunatly this gives me several problems on other areas in the code and outside the code, so this i'll have to take some time to see what is effected by this

                Thank you very much. I hope there will be other solutions that can fix the problem without too many changes to other systems. Otherwise i'll have to do a lot of work :)

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32633

                  #9
                  Originally posted by Dopey Fletcher
                  Dopey Fletcher:
                  I'll see if i can post the access application this weekend, it will take some time to clear it of anything that would be useless to you
                  There's a balance to be struck. Strip out what you can easily. If there's stuff which will be complicated to strip out, and which doesn't make the situation difficult, then leave it. Always test that it exhibits the symptoms before attaching though.

                  PS. I've added an extra post to that thread with some code that may help if dealing with a large and/or complex database.

                  Comment

                  Working...