Form state AfterUpdate differs btw key & click

geoB

Registered User.
Local time
Today, 01:23
Joined
Oct 10, 2008
Messages
68
In ACC2010: A subform has a control for date of birth with an AfterUpdate Event. When the date picker is used to populate the control the user must either click outside the control or press the tab key to trigger the control's AfterUpdate event. This event runs some calculations, the results of which are stored in a separate table. When the calculations are finished and focus returns to the form, the form's state depends on whether a keypress or a mouse click was used to trigger the event. The form's state is indicated by whether calculated controls on the form are empty - mouse clicks leave contents as before the event, tab causes the contents to disappear. In addition, if a keypress is used the user must click twice to trigger the form's BeforeUpdate event. A single click is required to trigger that event if a mouse click occurred after using the date picker.

How to get thekeypress to behave the same as a mouse click?


Thanks. George
 
Last edited:
...When the calculations are finished and focus returns to the form, the form's state depends on whether a keypress or a mouse click was used to trigger the event...

...mouse clicks leave contents as before the event, tab causes the contents to disappear...

Sorry, but I have no idea what you mean by these statements. Also, it is seldom appropriate to store calculated Fields, much less store them in Tables that the components didn't come from. But all of this aside, one approach to forcing the triggering of the Control's AfterUpdate event is to use the OnChange event to send the Focus elsewhere:
Code:
Private Sub DateField_Change()
  AnotherControl.SetFocus
End Sub
where AnotherControl is just that...any other Control on the Form that can receive Focus. This code allows the selection of a date and forces the AfterUpdate event without the user doing anything else. Just replace DateField and AnotherControl with the appropriate Control names.

Linq ;0)>
 
Thanks for the reply. I'll try to be clearer.

First, what happens in the AfterUpdate event is irrelevant. It calculates a To Do list for tasks that are scheduled based on the DOB.

What matters: the subform is to collect data on a newborn. It appears in a page in a tab control. The calculated field on the form is the mother's name. The date picker is used to enter the DOB. (btw, at the OnChange event the control contents are reported as null. I've tried using a length and date test on the contents in OnChange to no avail.) If I click in another control, when the AfterUpdate event is completed the mother's name field is correct. Clicking on a tab to trigger the form's BeforeUpdate event occurs. My issue is if I instead press the Enter key or Tab key to exit the DOB field, the mother's name control is blank. One click anywhere refreshes the contents of the mother's name control. The second click can trigger the BeforeUpdate event.

Hope this is clearer.

g
 

Users who are viewing this thread

Back
Top Bottom