form textbox date field - have to double click (1 Viewer)

Jaye7

Registered User.
Local time
Tomorrow, 00:23
Joined
Aug 19, 2014
Messages
205
I have a textbox on a subform which is a date picker textbox.

On the main form is a back button which takes you back to the previous form.

When you manually enter a date into the date picker textbox on the subform you can click on the back button and it will take you back to the previous form.

If you select a date using the actual date picker in the textbox instead of typing a date in, then you have to click the back button twice to go back to the previous form.

I have tried all sort of events with the textbox, like lost focus, after update etc... and the only one that actually works is the change event, but it changes every single time you enter a digit, which is not what I want to happen, so change works well if they automatically select a date but not if they type a date.
 

MarkK

bit cruncher
Local time
Today, 07:23
Joined
Mar 17, 2004
Messages
8,187
On the main form is a back button which takes you back to the previous form.
How does that work exactly? Because there is no stock "back button" in Access. You can't just re-render the previous page like you can in a browser.

What code runs when you click that button? If you set a breakpoint in that code, what happens on the first click when you get the failure? That is where I would start looking.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:23
Joined
May 7, 2009
Messages
19,246
on the after update event of your date picker textbox set Focus on your "back button" command button:

Private Sub yourTextBox_AfterUpdate()
' your code here
Me.yourCommandButton.Setfocus
End Sub

substitute the correct conrol name with blue colors.
 

Jaye7

Registered User.
Local time
Tomorrow, 00:23
Joined
Aug 19, 2014
Messages
205
The back button is just a command button that when pressed closes the current form and opens another form.

There is no error with the back button, even if I just type code like msgbox "hello" the focus stays on the date picker textbox until you tab off it or click the back button twice, but it's not just for the back button, there are other buttons or fields that they may want to select or fill in.

I can not set focus to the back button as when you use the automatic date picker selector it doesn't see it as updated until you tab off it etc..., whereas when you type the date in manually you can set the focus to any button you like.
 

drybone

Registered User.
Local time
Today, 10:23
Joined
Mar 31, 2015
Messages
29
would it be possible for you to set the default value on the date box to =Now() or whatever format you prefer?
 

Jaye7

Registered User.
Local time
Tomorrow, 00:23
Joined
Aug 19, 2014
Messages
205
I can, but it doesn't help with the fact that the date they want is different so they select the date picker for tomorrow etc... and access still see's it as having focus until you manually tab off it, sendkeys to tab off don't work either, as it just refuses to see it as changed or to remove focus.
 

JHB

Have been here a while
Local time
Today, 16:23
Joined
Jun 17, 2012
Messages
7,732
..
If you select a date using the actual date picker in the textbox instead of typing a date in, then you have to click the back button twice to go back to the previous form.
I can't reproduce that behaviour, could you post a stripped down version of your database with some sample data in it, (zip it) + name of the form.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:23
Joined
May 7, 2009
Messages
19,246
another alternative would be to use the your textbox datepicker OnChange event:
Private Sub yourTextBox_Change()
' your code here
Me.yourCommandButton.Setfocus
End Sub
 

Jaye7

Registered User.
Local time
Tomorrow, 00:23
Joined
Aug 19, 2014
Messages
205
Hi, As explained in my first/original post, the change event will not work.

I have tried all sort of events with the textbox, like lost focus, after update etc... and the only one that actually works is the change event, but it changes every single time you enter a digit, which is not what I want to happen, so change works well if they automatically select a date but not if they type a date.
 

JHB

Have been here a while
Local time
Today, 16:23
Joined
Jun 17, 2012
Messages
7,732
Did you read post #7?
 

Jaye7

Registered User.
Local time
Tomorrow, 00:23
Joined
Aug 19, 2014
Messages
205
Hi JHB,

I won't have access to the file for a couple of days, I will modify it and get back to you, thanks.
 

MarkK

bit cruncher
Local time
Today, 07:23
Joined
Mar 17, 2004
Messages
8,187
I can't reproduce this behavior either.

I only need to click another control twice if the calendar is still open, but I would say that behavior is by design. But if the calendar is still open, it can only be because the user has not clicked a date in the calendar.
 

Users who are viewing this thread

Top Bottom