Somtimes we need to run some code asynchronously. I'll explain this by example.
Suppose you have a listbox and you need to perform some action in the listbox AfterUpdate event procedure. But the problem is that your action is pretty heavy (it involves opening recordset based on complicated query, making some calculations and hiding \ viewing controls, based on the results). So when the user tries to "walk" through the list pressing Up and Down arrows (triggering AfterUpdate event at each step), it appears to be VERY slow.
The solution I present here uses the ability of Access to evaluate calculated fields asynchronously.
1. Create a function in form module.
- Function MyAction() As String
-
'put your action code here
-
End Function
2. On the form, create hidden field with ControlSource as
This scheme will work like AfterUpdate event, except the case when listbox selection changes too fast. In that case, the MyAction function will only run at the final step, without slowing down user selection.