M
MikeC
I'm using an Access XP form as a popup calendar that enables the user to
select dates and thereby pass the date data to various bound text box
controls on other continuous and non-continous forms and subforms and
subforms of subforms...
On one of my "regular" continuous forms, I want to immediately detect when a
new value entered into the text box falls outside a date range defined by
two other unbound text boxes in the header section of the same form. Once
this condition occurs, I want to undo the change, prevent any other changes,
and notify the user that a different date needs to be entered.
The problem is that when the date is *programatically* passed to the text
box control, the text box doesn't "know" it has been populated, so the *text
box's* BeforeUpdate event does not fire. The same is true for the text
box's Dirty, Change and AfterUpdate events. The only event I have found so
far that detects the change is *form's* BeforeUpdate event. However, this
event occurs later than I prefer. (Also, worth noting is that the form's
Dirty event does not fire in spite of the fact that the form "knows" to fire
the BeforeUpdate event.)
I've also tried the text box's LostFocus event to compare the old and new
values, but this technique gets cumbersome and also requires that the
control lose focus after it's value has changed and this isn't necessarily
going to be true.
Is there a preferred method, for the above scenario, to immediately detect
when the value of a control has been programmatically changed?
select dates and thereby pass the date data to various bound text box
controls on other continuous and non-continous forms and subforms and
subforms of subforms...
On one of my "regular" continuous forms, I want to immediately detect when a
new value entered into the text box falls outside a date range defined by
two other unbound text boxes in the header section of the same form. Once
this condition occurs, I want to undo the change, prevent any other changes,
and notify the user that a different date needs to be entered.
The problem is that when the date is *programatically* passed to the text
box control, the text box doesn't "know" it has been populated, so the *text
box's* BeforeUpdate event does not fire. The same is true for the text
box's Dirty, Change and AfterUpdate events. The only event I have found so
far that detects the change is *form's* BeforeUpdate event. However, this
event occurs later than I prefer. (Also, worth noting is that the form's
Dirty event does not fire in spite of the fact that the form "knows" to fire
the BeforeUpdate event.)
I've also tried the text box's LostFocus event to compare the old and new
values, but this technique gets cumbersome and also requires that the
control lose focus after it's value has changed and this isn't necessarily
going to be true.
Is there a preferred method, for the above scenario, to immediately detect
when the value of a control has been programmatically changed?