Solved Input mask for hours (1 Viewer)

zelarra821

Registered User.
Local time
Today, 13:57
Joined
Jan 14, 2019
Messages
522
Good afternoon. I'm looking at the Access help for how to put an input mask to enter times that allows me to enter, for example, 0: 1: 34 without having to write a zero in front of the one, that is, like this: 0:01:34. Currently, the one I use is this: 9:00:00;0; _, and I don't know how I have to put it to achieve it.
Thank you.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:57
Joined
Oct 29, 2018
Messages
16,600
Hi. I would be surprised, but it's probably not possible using just Input Mask. I would say forget Input Mask and just use code.
 

zelarra821

Registered User.
Local time
Today, 13:57
Joined
Jan 14, 2019
Messages
522
Hi. I would be surprised, but it's probably not possible using just Input Mask. I would say forget Input Mask and just use code.
And how should I do it?
 

zelarra821

Registered User.
Local time
Today, 13:57
Joined
Jan 14, 2019
Messages
522
In the table, Date/Hour, and format Long hour.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:57
Joined
Oct 29, 2018
Messages
16,600
In the table, Date/Hour, and format Long hour.
Okay, just thinking out loud here. I would probably use an unbound Textbox for the user input; then in the AfterUpdate event, use code to parse the input and populate the Date/Time field appropriately.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:57
Joined
Oct 29, 2018
Messages
16,600
Ahhh, okay. I had not fallen in that.
The reason I say that is because if you use the bound control for user input, invalid time input might trigger an error message before your code could get a chance to validate the input and therefore provide the user a better prompt on how to fix it.
 

zelarra821

Registered User.
Local time
Today, 13:57
Joined
Jan 14, 2019
Messages
522
Thanks a lot. I will try, but having two fields for the same, one of them independent, do not think that I am very funny, because I already tried it once with a database and I did not like how it looked. Anyway,
 

theDBguy

I’m here to help
Staff member
Local time
Today, 05:57
Joined
Oct 29, 2018
Messages
16,600
Thanks a lot. I will try, but having two fields for the same, one of them independent, do not think that I am very funny, because I already tried it once with a database and I did not like how it looked. Anyway,
Hi. Not sure we're on the same page. I didn't suggest using two fields. I said to use an unbound Textbox to populate the single field in your table.
 

zelarra821

Registered User.
Local time
Today, 13:57
Joined
Jan 14, 2019
Messages
522
If I have understood you, it is that I have explained myself wrong. This using another language is what you have.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 08:57
Joined
May 21, 2018
Messages
5,495
See demo. The actually bound field is not displayed, but you could if desired.
 

Attachments

  • DemoTime.accdb
    992 KB · Views: 135

Users who are viewing this thread

Top Bottom