Quick Time Entry

ButteDuLac Posted messages 534 Status Member -  
ButteDuLac Posted messages 534 Status Member -
Hello,

In a form from my database (Access 2010), I would like the user to be able to quickly enter the time.

So, if the time to enter is 14:45, with my input mask (00:00!;0;_), it suffices to type "1445", but when the time to enter is 9:30 or even 14:00, I would like the user to only have to enter "930" or "14" and that by default, the 00 for the minutes should be added, and that the 0 before the 9 (9:30 instead of 09:30) should be optional. I have tried these different input masks:
99:99!;0;_
90:99!;0;_
90:00!;0;_
99:99;0;_
9:99;0;_

I have also tried masks like 00:00;0;0, etc., thinking that the 0 would remain by default and would be taken as the value 0, but it's just a placeholder... I tried setting the default value to 00:00, thinking that typing would replace the value, one by one, but as soon as a digit is entered in the field, the default value 00:00 disappears and is replaced by ... the placeholders (whether they are _ or 0) and you have to enter all four digits again...

My format (in the table) is "Time, short".

I know it can be done, as I have experienced it in other databases where I was a user, but maybe Access doesn't allow it???

Solution??? Thanks!

Configuration: Configuration: Windows / Chrome 55.0.2883.87

2 answers

  1. JONAS KAPEND Posted messages 32 Registration date   Status Member Last intervention  
     
    Hello, this is Jonas Kapenda from the Democratic Republic of Congo.
    I advise you to create 2 text fields for hour and minute, while limiting the number of characters in each field.
    When printing the statement, you merge them.
    0
    1. ButteDuLac Posted messages 534 Status Member 41
       
      Thank you, but that doesn't work. I have calculated fields that take the time into account.
      0
    2. yg_be Posted messages 23437 Registration date   Status Contributor Last intervention   1 588 > ButteDuLac Posted messages 534 Status Member
       
      You could indeed, as suggested by Jonas Kapenda, have two fields in the form and group them to store the time in the database. Why not?
      0
    3. ButteDuLac Posted messages 534 Status Member 41 > yg_be Posted messages 23437 Registration date   Status Contributor Last intervention  
       
      Yes, thank you.... but I wonder... if the person has to enter the hour, then hit Tab to move to the minutes... then Tab again to exit the minutes field and go to the next one... where is the time saved? (Ex.: for 12:45, instead of doing [1+2+4+5+Tab], the person will do [1+2+Tab+4+5+Tab] as currently, or, for 09:00, they would do [9+Tab+Tab], instead of [0+9+0+0] as currently... whereas with the method I want to achieve, the person would do [9+Tab], or [9+2+Tab] for 09:20, and that's it!)

      And given that I already have a large number of fields in my database, it would add two more, and I would have to replace the initial field with two other fields in each form where I have a time to enter, and all the hassle that comes with it. Whereas if I have a VBA code associated with my input mask (which is already on my field), I can copy-paste the code and it’s much faster...

      Still, thank you for the suggestion...
      0
    4. yg_be Posted messages 23437 Registration date   Status Contributor Last intervention   1 588
       
      It's not ideal, but it doesn't require having two fields in the database: you would have two fields in the forms, one only in the database.
      0
    5. ButteDuLac Posted messages 534 Status Member 41 > yg_be Posted messages 23437 Registration date   Status Contributor Last intervention  
       
      In the sense that I could put on a mask with 99;1;_, I imagine?
      Except that I have to remove all my HOUR field controls to replace each with two new field controls HH and MM (let's say I'm working simultaneously on two databases, each with several hour fields, for example: [start_time] and [end_time] for a training; [birth_time], [time_X], [time_Y], etc. (X and Y being actions to be taken in the management of file Z...
      So I'm desperately looking for a way to proceed, since I know it's possible...

      That said, your idea is good. It's just that it's not really what I'm looking for.

      But you are really great to help me!
      0
  2. ButteDuLac Posted messages 534 Status Member 41
     
    En Javascript, il y aurait quelque chose qui ressemble (je crois) à ...

    function _HVC(h,f){if(h=="")return"";var r=f;var nPos=r.indexOf("HH");if(nPos>-1)r=r.substring(0,nPos)+h.substring(0,2)+r.substring(nPos+2,r.length);nPos=r.indexOf("MM");if(nPos>-1)r=r.substring(0,nPos)+h.substring(2,4)+r.substring(nPos+2,r.length) nPos=r.indexOf("SS");if(nPos>-1)r=r.substring(0,nPos)+h.substring(4,6)+r.substring(nPos+2,r.length);nPos=r.indexOf("CC");if(nPos>-1)r=r.substring(0,nPos)+h.substring(6,8)+r.substring(nPos+2,r.length);return r} function _CVH(h,f){if(h=="")return"";var e=f.indexOf("HH");if(e==-1)return"";var m=f.indexOf("MM");if(m==-1)return"";var s=f.indexOf("SS");var t=s==-1?"00":h.substring(s,s+2);var c=f.indexOf("CC");var d=c==-1?"00":h.substring(c,c+2) return h.substring(e,e+2)+h.substring(m,m+2)+t+d} function _EVH(e){var h=""+Math.floor(e/(100*3600));if(h.length==1)h="0"+h;e=e%(100*3600);var m=""+Math.floor(e/(100*60));if(m.length==1)m="0"+m;e=e%(100*60);var s=""+Math.floor(e/(100));if(s.length==1)s="0"+s;e=e%(100);var c=""+Math.floor(e) if(c.length==1)c="0"+c;return h+m+s+c} function _HSY(){var d=new Date();var h=""+d.getHours();if(h.length==1)h="0"+h;var m=""+d.getMinutes();if(m.length==1)m="0"+m;var s=""+d.getSeconds();if(s.length==1)s="0"+s;var ms=""+d.getMilliseconds();if(ms.length==1)ms="0"+ms if(ms.length>=2)ms=ms.substr(0,2);return h+m+s+ms} function _HVE(h){return(h.substr(0,2)*360000)+(h.substr(2,2)*6000)+(h.substr(4,2)*100)+(h.substr(6,2)*1)} function _JGP(d){return d.forms[0]}


    Mais je ne connais aucunement le Javascript (juste une déduction...)

    Je n'ai aucune idée comment traduire ça en VBA.

    Besoin d'un coup de pouce!!!
    0