Fast date amendment in text box (1 Viewer)

GK in the UK

Registered User.
Local time
Today, 01:18
Joined
Dec 20, 2017
Messages
274
I have an invoice form with a date field which defaults to today. I want the user to be able to overtype characters without pushing over the existing text, and without having to re-type the entire field including the / character.


So if the field offers 20/02/2018 I would like the user to be able to enter 19 <enter> to change the field to 19/02/2018


Is this possible ?
 

Minty

AWF VIP
Local time
Today, 01:18
Joined
Jul 26, 2013
Messages
10,371
Not easily, how does it know you mean to change the day part of the date?

If you use an input mask for the date, it will sort of behave like you want, but it's a royal pain if you want to change the whole date.
 

GK in the UK

Registered User.
Local time
Today, 01:18
Joined
Dec 20, 2017
Messages
274
I find the date input field is a bottleneck for fast input if you need to change from the default. More often than not the user just needs to amend the date by a day or so and continue.


If there isn't an inbuilt Access way of doing it I'll have to see if I can do it in VBA.
 

Minty

AWF VIP
Local time
Today, 01:18
Joined
Jul 26, 2013
Messages
10,371
In general you can simply type 13/2 and hit return and it will default to the current year in a date field.

I'm pretty sure you would have to resort to something in the before update event of the field to stop it giving you an error if you simply typed in 13 for instance?

The other option would be to set the default to the last entry if it repeats frequently?
 

GK in the UK

Registered User.
Local time
Today, 01:18
Joined
Dec 20, 2017
Messages
274
What I'm after is the ability to change the default date which the standard date box doesn't seem to do. I set the format to Short Date. But if it defaults to 13/02/2018, enter the field, and press 12, I get 1213/02/2018. I want the 12 to over write the 13.


I've written some code with uses the .text property to retrieve the character typed and assemble a new string from the old text and the new character then re-position the cursor. It uses the OnChange event for each character typed. It all works seamlessly and does exactly what I've described, it even jumps over the / separators so if the user wants to change the day of month and month, they need only type 1203 <enter> to change the date to 12/03/2018. Very fast data entry which is what I'm after.


But, when I inserted this test code into a bound date field it throws errors because the intermediate updated values of the date are invalid. So more work is required. As you suggest I may have to look at validating it in the BeforeUpdate event of the bound date field.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 17:18
Joined
Aug 30, 2003
Messages
36,125
Post 5 was moderated, I'm posting to trigger email notifications.
 

bob fitz

AWF VIP
Local time
Today, 01:18
Joined
May 23, 2011
Messages
4,721
I find the date input field is a bottleneck for fast input if you need to change from the default. More often than not the user just needs to amend the date by a day or so and continue.
Would it work for you if the date could be altered by one day with each press of the "+" or "-" keys.
 

GK in the UK

Registered User.
Local time
Today, 01:18
Joined
Dec 20, 2017
Messages
274
I'm using my custom date input routine which over writes the characters as they're typed. I did experiment with highlighting the single character to the right of the cursor, which would make the behaviour in line with Access/Windows conventions, but I found that the highlighted character was sometime had to discern. So I'm sticking with my slightly non-conventional interface. The date picker is still available. It does mean I have to use an unbound field and pass it into the bound date field in the OnExit event after validation.
 

Users who are viewing this thread

Top Bottom