Unbound Text field for Date and time entry in access form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rajeevs
    New Member
    • Jun 2007
    • 171

    Unbound Text field for Date and time entry in access form

    Greetings
    I am back with a new problem. I have a form with unbound textbox with format as ddmmmyy hh:nn. I have set the property of the field date picker = for dates. The problem is that when I select a date first it shows in the ddmmmyy hh:nn format, but if i change the date and change the time then it shows with seconds which I dont want.
    I would like to show the field with ddmmmyy hh:nn and need to edit with the same format. When a user select the field it should not expand as general date format and the user needs to edit the hour and minute, but at the moment he has to be careful else it will end up editing the minutes and seconds.
    In short I like to have an unbound TextBox control with
    date and time shows as example : 25Dec12 18:15 and need to edit with the same format.
    Hope I explained correctly. Thank you all in advance for the help
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    That's a strange behavior.
    I take it to mean that you are getting: 25Dec12 18:15:00 when you click in the field or using the date picker - in otherwords... how are you changing the field value?
    Is there any vba associated with the field that edits/writes to the field? If so, I'd like to take a look at that code

    Comment

    • rajeevs
      New Member
      • Jun 2007
      • 171

      #3
      Thank you for the quick reply zmbd.
      When I first select the date from date picker the field shows the date and time as 00:00. But after exiting and re-enter the field it shows only the date and if I add a differnet time other than 00:00 then again if u enter the field it will show the date and time with format dd-mm-yy hh:nn:ss.
      Hope it is clear. I will attach a sample db with a single form having two unbound text fields without any vb involved.(But I dont know how to send the db to you
      Thank you once again zmbd

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        Rajeev, You needn't attach an example database unless requested. We always prefer that you explain the problem clearly in words where possible. An attached database saves you the time and effort of asking the question properly, but leaves us with the extra effort of working out what the question should have been vefore we can answer it. We prefer (and the site requires) you to ask the question properly. If any of us requests that you support this with an example attached then one can be attached at that point.

        As for your control, it isn't very clear at this point what is happening and why. However, it is clear that the format you use is not a standard date or date and time format. I suspect then, that it will be treated as a string in some situations, and a string which the system is unable to interpret as a date. If you put spaces between the elements (Such as "d mmm yyyy"), you may find the problem disappears. If you try this and you still have the problem then please explain the problem in more precise detail and we'll see what we can do to help you find a more reliable way of handling this.

        Comment

        Working...