The problem is how can I use this code to a separate thread with a callback to vba that uses UI elements of MS Access Form without crash. I had just removed the details not to mislead someone.
No, that is not the case. Class instances are isolated from each other and the code of class modules is re-entrant (if you wrote it that way). It works to use multiple class instances in a single threaded environment, and it works as well with multiple instances in a multithreaded environment. I said in the video that you shouldn’t touch classes because that significantly increases the risk of Access/VBA crashing, but not because the instances aren’t isolated/re-entrant in general.I'm going out on a limb here to say that part of the problem is that you don't get a new copy of the code for NEW class object methods. If you did, the code would indeed be re-entrant.
No chance whatsoever. I actually wrote the code in Access 2016 originally and noticed that it was crashing left, right, and centre. I was about to scrap the whole project when I ran the code in Access 2010 and noticed it runs there without crashing.Something has changed between then and now, probably related to the difference between 32-bit and 64-bit code. Is there a chance that your original code was Ac2007, not Ac2010?