Reputation: 25262
On a normal textbox, I usually use the AfterUpdate
event to perform some action. That means the user has to press Enter or Tab after typing, or click in another control, and I have always been happy with that behaviour.
Now I am setting up a Date filter in the header of a continuous form in Access 2010, and I realize that changing the date through the little calendar that comes automatically, does NOT fire the AfterUpdate
event, forcing to press Enter after selecting the correct date, which is a bit heavy.
Using OnChange
would trigger at every character entered, which is not nice either.
Any suggestion ?
Upvotes: 0
Views: 3247
Reputation: 1
I use it in this way
Private Sub txt_FirstDate_Change()
txt_FirstDate = txt_FirstDate.Text
myfilter
End Sub
Upvotes: 0
Reputation: 1284
It is a bit late reply but I hope it will help the others. When using textbox as a DatePicker you should use Change Event with your filter.
However when you are checking your textbox like Form_name.TextboxName
it will show last picked date. To avoid that and use currently selected one you need to provide current date like Form_name.TextboxName.Text
. Careful here because .Text
property is sensitive to focus.
...in short:
Form_name.TextboxName
- will show last picked date
Form_name.TextboxName.Text
- will show currently picked date
Upvotes: 2
Reputation: 11
well, after you select a date from the date-picker, the Change event occurs for the TextBox control. Then, call a sub or function or set focus to another control... to avoid event fires for each pressed key, put something like: if Len(me.activecontrol) < 10 then exit sub
I hope this helps
Upvotes: 1
Reputation: 1
I use LostFocus event in the textbox. It allows to use the calendar tool and alter the content. The User has to leave the textbox sooner or later, isn't it?
Upvotes: 0