Textbox time input autocomplete, possible?

I have a textbox with this input mask: 99:00\ >LL;0;_, its basically "##:## AM/PM".  I was wondering if it's possible to have that textbox autocomplete when for example someone enters a military time (ex. 23:00), when he tabs out of that text box, it defaults to 11:00 PM, is it possible for an unbound textbox in Access? Thanks!
jad0083Asked:
Who is Participating?
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
Private Sub text1_AfterUpdate()
    Me.Text1 = Format(Me.Text1, "hh:nn am/pm")
End Sub
0
 
GRayLCommented:
If you make the format of the text box Medium time, then so long as the user enters a 'valid' time, something less than 23:59, it will get converted to the correct am/pm value.  In your case I tested with 23:00 and it converted it to 11:00 PM
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
"If you make the format of the text box Medium time,"

Well, except that Medium Time is going to depend on the medium time setting in Windows Regional and Language settings ...

mx
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
GRayLCommented:
Not quite.  I've got my regional set to the 24 hour clock.  When I select a named time format like Medium it gives the 12 am/pm setting. Both Long and Short times provide the 24 hour clock.  I've just tested and Medium time always give the 12 hr am/pm format regardless of the regional settings.
0
 
GRayLCommented:
mx:  BTW there is no Medium time in my Regional and Language settings...  I was giving a solution that did not require code.  However, the customer is always right ;-)
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
"BTW there is no Medium time in my Regional and Language settings."

Yes, but ... selecting Medium Time in the text box Format ... the displayed result is still impacted by the 'Time Format' in Regional and Language settings ... is what I meant to say ... I misspoke and said 'Medium Time' setting.

mx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.