Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    viperbyte is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2012
    Posts
    3

    Military Time Blues

    Hi everyone. I need to be able to allow a user to enter a military time value in a form. I've tried placing a datetimepicker control but don't know how to make it so that the user will enter military time.



    I'll need for the program to track the time an employee's logged in based on their military clock in and militrary clock out values entered by the way.

    Is the datetimepicker control the way to go? If not, how do I go about this? Please.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I've never used a picker for time, so not sure if there's one that allows that. I use an input mask of this in a textbox:

    00:00;0;_
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    viperbyte is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2012
    Posts
    3
    Thanks for the input mask tip

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem, and welcome to the site.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Etoimos is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Mar 2020
    Posts
    249
    I'm trying to do the something very similar for a couple of fields on my form. I want the employee to enter in the time as hh:mm:ss in military time. When I try putting that into the Input Mask, it displays "hh:nn:ss" in the text box and does not allow me to actually enter a time in it. Any thoughts on what I'm doing wrong?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Did you try adding seconds to what I posted earlier?

    00:00:00;0;_
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Etoimos is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Mar 2020
    Posts
    249
    Quote Originally Posted by pbaldy View Post
    Did you try adding seconds to what I posted earlier?

    00:00:00;0;_
    No, I just did and it worked. I guess I'm confused on what the ;0;_ part of that mask means.

  8. #8
    Etoimos is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Mar 2020
    Posts
    249
    Also, when I enter at time such as 22:34:15, it does not show the 15 seconds. It is there if I go back and click on the field again, it then shows the seconds, but the whole time has been converted to standard 12 hour time with an AM or PM attached to it. Moving away from the field again, it changes back to 24 hour time, but without showing the seconds.

  9. #9
    Etoimos is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Mar 2020
    Posts
    249
    It is also not saving the seconds into the underlying table. That is Formated as Short Time with the same Input Mask as the form.

  10. #10
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    to show the seconds I believe you need long time in your table and mask

  11. #11
    Etoimos is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Mar 2020
    Posts
    249
    Quote Originally Posted by moke123 View Post
    to show the seconds I believe you need long time in your table and mask
    That works to get it to show/record the seconds, but it kills the 24 hour/military format. If I enter in 23:45:30, the field gets converted to 11:45:30 PM.

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try a format on the textbox of

    hh:nn:ss
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    Etoimos is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Mar 2020
    Posts
    249
    Quote Originally Posted by pbaldy View Post
    Try a format on the textbox of

    hh:nn:ss
    That works for displaying military time in the form. The underlying table is still populated with an AM/PM format, but that might not be any issues as long as any reports I generate from that data is able to be displayed in military time.

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The table is going to store the same thing either way, it's just a formatting issue (date/time values are stored as doubles, where the decimal portion is the time). Since I never let users directly into tables I never bother applying a format there, but you could if you wanted.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  15. #15
    Etoimos is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Mar 2020
    Posts
    249
    Quote Originally Posted by pbaldy View Post
    The table is going to store the same thing either way, it's just a formatting issue (date/time values are stored as doubles, where the decimal portion is the time). Since I never let users directly into tables I never bother applying a format there, but you could if you wanted.
    Okay. On my subsequent forms I would still be able to apply a format that would show the time on them in military time even if the time in the table was standard time correct?

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 08-04-2011, 07:49 PM
  2. Military Time
    By tshirttom in forum Access
    Replies: 3
    Last Post: 07-29-2011, 01:29 PM
  3. Hesitation production psychological SQL Blues
    By byterbit in forum Queries
    Replies: 1
    Last Post: 05-11-2011, 02:36 PM
  4. Time: How to increment time in form
    By dek in forum Forms
    Replies: 1
    Last Post: 05-07-2011, 12:47 AM
  5. Replies: 12
    Last Post: 02-22-2011, 03:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums