Forum Discussion

David_Richardson's avatar
David_Richardson
Copper Contributor
Jun 21, 2023

Asynchronous Event processing in Access 365 ?

I have a client that recently upgraded from standalone office to Office 365.  Today they called with an error that on first glance defied logic.  But upon delving deeper it appears that Access is executing the AFTER UPDATE and ON KEY DOWN events behind the form simultaneously causing and IF statement in the ON KEY DOWN event to be processed incorrectly.  

Has anyone seen this before?

If so do you have any suggestions on how to prevent this from happening?

 

Thanks

 

  • David_Richardson Can you put a really small db together that demonstrates this problem? I for one am skeptical. Access is of course multi-threaded, but it has only one UI thread.

    • David_Richardson's avatar
      David_Richardson
      Copper Contributor
      I will attempt to put together something to demonstrate it, but maybe an explanation. Based on what you have said... The AFTER UPDATE event called a function from a Code Module, while the ON KEY DOWN was executing code behind the form. In that case could it have cause them to execute simultaneously?

      What was happening is the ON KEY DOWN checked a condition IF X.ENABLED=True Then Set Focus to field X. The Code called in the AFTER UPDATE event checked various other conditions and set the X.ENABLED = FALSE. So from what we could determine it looked like the ENABLED property evaluated TRUE in the ON KEY DOWN's IF statement, then the value was changed from the Function called by the AFTER UPDATE event before the ON KEY DOWN tried to Set Focus to field X.