[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 329
  • Last Modified:

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!
0
jad0083
Asked:
jad0083
  • 3
  • 3
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
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 MVP, Access and Data Platform)Commented:
"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
Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

 
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 MVP, Access and Data Platform)Commented:
"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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now