MS Access Input Mask for Time

83 Views Asked by At

I'm working on optimizing UX for data entry in a text box bound to a time field. The form is for professionals to enter billable time entries.

The objectives are:

  • Avoid the necessity of entering a colon, i.e., the time separator, between hours and minutes.
  • A default leading zero ("0") in hours. I.e., typing "123" results in 01:23, or 1:23 AM.
  • Minutes default to "00". I.e., typing "11" results in 11:00, or 11:00 AM; taken with the above, typing "1" results in 01:00, or 1:00 AM.

The question is whether and how the latter two can be accomplished with an input mask. Put otherwise, can an input mask define default characters. I suspect the answer is no in both cases and some other code is necessary but wanted to ask.

I've tried the input mask @Gustav recommends here ("90:00;1;0") and a variety of variations. These succeed in avoiding the colon but not the others. I.e., typing "1234" results in 12:34, or 12:34 PM. Typing "1", "12", or "123" are generally invalid, however.

The configuration "90:99;1;0" does this and also permits typing "123", although, quite oddly, this results not in 01:23 but 12:03 (providing a leading zero in minutes but not hours).

Quoting, including escape, can provide a character and specifying "0" in the property's second section will write its value. It can't be overridden, however, so the character isn't a default character. E.g., \09:"00";0;0 allows one to type "1" and input 1:00 AM, but typing "12" is invalid.

Another oddity is that neither the colon, nor any of the input mask, for that matter, appears in the text box, either before or after entering it. No variation of the property's third section has any effect.

Also, using the exclamation point has no effect: With or without it, hours and minutes both fill from left to right, even with masks that permit, e.g., typing "123" (and note, this displays as "12:30" before update and "12:03" after).

Any thoughts, including "just punt and write the code" would be welcome.

0

There are 0 best solutions below